URL rewriting issue when postbacks and URL rewriting

来源:互联网 发布:午夜福利直播软件 编辑:程序博客网 时间:2024/06/07 12:02

When postback, it will cause a 301 redirect to get the rewrite page, so it will lose the original post.

http://blogs.iis.net/ruslany/archive/2008/10/23/asp-net-postbacks-and-url-rewriting.aspx

 

 

The key solution:

protected void Page_Load(object sender, EventArgs e)
{
if ( !String.IsNullOrEmpty(Request.ServerVariables["HTTP_X_ORIGINAL_URL"]) )
{
form1.Action = Request.ServerVariables["HTTP_X_ORIGINAL_URL"];
}
}
原创粉丝点击