I have rewrite rules on web.config file.
<rewrite url="~/Login/(.+)$" to="~/Login.aspx?return=$1"/>
<rewrite url="~/(.+)-xxx-(.+)$" to="~/Post.aspx?ost_name=$1&post_id=$2"/>
First one for redirect url after login. Second one for posts.
If users try login or click comment on post page they will go to login page with redirect url.
protected void lnkLogin_Click(object sender, EventArgs e)
{
Session["GoBackUrl"] = Request.RawUrl.ToString().Replace("/", "$");
base.Response.Redirect("~/Login/" + Session["GoBackUrl"].ToString());
}
For example
domain.com/Login/$post_name-xxx-post_id
After login they will turn back to post page.
But with this rules they are not going login page. Url is changing as
domain.com/Login/$post_name-xxx-post_id
but user stays same page. How can I solve this ?
I found this example from Devrim Altinkurt's (lang:Tr) page and wrote him. He helped me.
Solution: "processing="stop"
<rewrite url="~/Login/(.+)$" to="~/Login.aspx?return=$1" "processing="stop/>
<rewrite url="~/(.+)-xxx-(.+)$" to="~/Post.aspx?post_name=$1&post_id=$2"/>
When you don't write. Application looks all rules and firing last match If you got same Url's you should use this. One more detail : rule ranks are important.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.