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";
View Complete Post