Last post Mar 22, 2011 03:02 PM by vinkesh
Mar 21, 2011 08:27 AM|vinkesh|LINK
I have implemented URL rewritting in my application. I did it in Application_BeginRequest located in Global.asax. My url rewritting in working fine. Now in order to maintain rewritting during post back.
I have added code line this.Form.Action = Request.RawUrl; in page load event in order to maintain rewritten URL during post back. When I am adding below code on image button click to download file it doesn't work. It says "Internet explorer
cannot display webpage". When I am removing line this.Form.Action = Request.RawUrl; from page load then downloading file will start working but URL rewritting will not work on postback. Please let me know work around to handle such condition.
FileInfo objFi = new FileInfo(Server.MapPath(filepath));
this.Form.Action = Request.RawUrl;
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + objFi.Name);
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/octet-stream";
Mar 21, 2011 09:56 AM|Small Peter|LINK
Is this page itself a file download? Then why do you want to maintain rewritten URL? I am sorry, but I didn't get it.
Mar 22, 2011 03:02 PM|vinkesh|LINK