This line:
lblEmpl.Visible = True
Never hits because this line:
Response.End()
Throws out a ThreadAbortException
, - HttpHandler "" . ( . /.)
IHttpHandler. .
. , , :
public class CensusHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string fileName = String.Format(
CultureInfo.CurrentUICulture,
"E_{0:00}{1:00}.csv",
DateTime.Today.Month,
DateTime.Today.Day
);
context.Response.ContentType = "text/csv";
context.Response.AddHeader(
"Content-Disposition", String.Format(null, "attachment; filename={0}", fileName)
);
context.Response.Flush();
}
public bool IsReusable { get { return false; } }
}
, onclick javascript :
<asp:Button ID="Clickety" runat="server" Text="Click Me!" OnClick="Clickety_Click"
OnClientClick="window.open('Handler.ashx', 'Download');" />
OnClick . javascript onclick (OnClientClick) HttpHandler.