Last post Jan 06, 2008 06:10 PM by REA_ANDREW
Jan 01, 2008 09:28 AM|REA_ANDREW|LINK
I have used Scott Gu's Url Rewriter solution many times. BUT this time it is not working correctly. The code sets a variable inside the HttpContext so that it will presist on postback. BUT this block here
value = Context.Request.RawUrl;
This should not be hit twice inside as the first run should go inside the block because Context.Items["ActionAlreadyWritten"] ==
null , but on the second time this should not be the case but it is the case.
Can anyone explain what is going wrong.
Jan 01, 2008 05:23 PM|REA_ANDREW|LINK
it appears that the cause of this is that the login status control causes a double postback which on the second postback retrieves the unrewritten url ergo the wrong one. My only thinking to this is to use the session state with this so:
Postback 1: Check if Session["AlreadyWritten"] == null and if so set it to true
Postback 2: Check if Session["AlreadyWritten"] == null , this will not be null so the correct rewritten url for the postabck will be stored.
PageLoad: Set Session["AlreadyWritten"] == null as the context state management life cycle is only as long as each request.
My question now is "Why does the LoginStatus control cause a double postback." Please try, set a breakpoint and trigger the control and you will see that it will enter the breakpoint twice each time.
Jan 03, 2008 02:27 AM|Guang-Ming Bian - MSFT|LINK
Can you provide more detail information:
If possible, some related code is more useful.
Guang-Ming Bian - MSFT
Jan 06, 2008 06:10 PM|REA_ANDREW|LINK
The ASP.NET Standard Login Status Control
It causes two postbacks. When using with URL Rewriting this is a problem.
I had to resort to the following.
A Simple Link Button which onclick calls the signout method of the FormsAuthentication
The UserLogin control also raises two postbacks when you say Login, or for the LoginStatus control, Logout