The HTML is like:
<asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false" OnLoggedIn="LoginUser_LoggedIn"
OnLoginError="LoginUser_LoginError">
</asp:Login>
On LoginUser_LoggedIn event I am setting the destination URL like:
LoginUser.DestinationPageUrl = "~/mycustompage.aspx";
FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, true);
Here when there is NO ReturnUrl in page URL then it is redirecting to "~/mycustompage.aspx" page but if there is any ReturnUrl specified in the URL then it is redirecting to the ReturnUrl page.
I always want to redirect to "~/mycustompage.aspx" page whether ReturnUrl is there or not. How to achieve this?
Many many thanks in advance!
DestinationPageUrlis the default destination page after Login.?ReturnUrlis stronger thanDestinationPageUrlso, if it is set it wins.Response.RedirectinLoginUser_LoggedInis stronger thanReturnUrlso, if you want to overrideReturnUrlyou must use this code:DestinationPageUrlshould be set in the aspx pageor in
Page_Loadevent to work properly.If you must change the destination page after login (in example if the page changes depending on the user or the user's role) you must use
Server.trasfer()oreResponse.Redirect().