What I have?
I have an ASP.NET page which allows the user to download file a
on a button click. User can select the file he wants from
I had same problem. Function to perform simple Response.Writer("") on Button Click event on aspx page was never firing.
Method in class:
public test_class()
{
public test_class() { }
public static void test_response_write(string test_string)
{
HttpContext context = HttpContext.Current;
context.Response.Clear();
context.Response.Write(test_string);
context.Response.End();
}
}
ASPX Page:
protected void btn_test_Click(object sender, EventArgs e)
{
test_class.test_response_write("testing....");
}
While I was trying to find the reason, I just called same function on Page_Load
event it worked.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
test_class.test_response_write("testing....");
}
}
Investigating the issue I found out that Master Page of that aspx page's body was under
.
I removed it, and it worked on Button_Click
Event. I would recommend you to check that too.