I generate a vcard that I send to the client using the following code snippet:
Response.AddHeader(\"Content-Disposition\", string.Format(\"attachment; filena
You can't use Response.Write
during an asynchronous postback. Whatever control executes that code needs to be added as a PostBackTrigger
in the update panel:
<Triggers>
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
You can also do it in code-behind, if you prefer:
ScriptManager.GetCurrent().RegisterPostBackControl(Button1);
Response.Write will not work under Asynchronous Events. My suggestion is to remove the Update Panel in case it is specifically being used for VCard point of view only.
Alternatively - Place a control inside the Update Panel and initialize it's value under asynchronous event. Now it will work.
I had a similar problem with Response.Write
. I found a workaround or maybe even a solution to this problem. Capture the TextWriter
given to the RenderBeginTag
of a server control and write to that.
I blogged with an example here: http://timscyclingblog.wordpress.com/2013/03/07/asp-net-web-forms-response-write-in-an-updatepanel-dev-web/
Why don't you consider the use of a separate handler/page to serve the vcard?
This is maybe the easiest and cleaner way to do that and it doesnt interfere any other (async or not) postback related to the updatepanel.