mj168
asked on
Problems with the ReturnURL
I have an index page with a LoginStatus control. See below. When the visitor clicks on 'Login' the visitor is taken to the Login page.
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutAction="RedirectToLo ginPage" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" ForeColor="#0000CC" />
On the Login page there is a Login control. See below. The problem I am having is that when the visitor correctly enters their login information and clicks the 'Login' button. The user is taken back to the index page and not the page assigned to the 'DestinationPageURL' property.
<asp:Login ID="Login1" runat="server"
DisplayRememberMe="False" PasswordRecoveryText="Forg ot Password?"
PasswordRecoveryUrl="~/gp. aspx"
DestinationPageUrl="~/user account.as px">
</asp:Login>
Thanks in advance.
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutAction="RedirectToLo
Font-Size="Small" ForeColor="#0000CC" />
On the Login page there is a Login control. See below. The problem I am having is that when the visitor correctly enters their login information and clicks the 'Login' button. The user is taken back to the index page and not the page assigned to the 'DestinationPageURL' property.
<asp:Login ID="Login1" runat="server"
DisplayRememberMe="False" PasswordRecoveryText="Forg
PasswordRecoveryUrl="~/gp.
DestinationPageUrl="~/user
</asp:Login>
Thanks in advance.
have u chekced that <authentication> tag in web.config file?
ASKER
Below is my <authentication> tag.
<authentication mode="Forms">
<authentication mode="Forms">
ASKER
Ignore the above. Below is my <authentication> tag.
<authentication mode="Forms">
<forms defaultUrl="login.aspx" />
</authentication>
<authentication mode="Forms">
<forms defaultUrl="login.aspx" />
</authentication>
try to attach the login event to the login control and redirect from code behind like this :
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
Response.Redirect(ResolveClientUrl(Login1.DestinationPageUrl));
}
ASKER
I tried the code you gave:
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls. Authentica teEventArg s) Handles Login1.Authenticate
Response.Redirect(ResolveC lientUrl(L ogin1.Dest inationPag eUrl))
End Sub
There are still problems. While It does go to the destination page url, the username that is supposed to display on the page does not show and also the login status displays "login", instead of "logout". It seems that redirecting in the login authentication event does not log the user in.
Below are code snippets for the loginview and loginstatus that are on the destination page url.
LoginView
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
Welcome,
</LoggedInTemplate>
</asp:LoginView>
<asp:LoginName ID="LoginName1" runat="server" />
LoginStatus
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutAction="RedirectToLo ginPage" Font-Bold="True" Font-Names="Arial"
Font-Size="Small" ForeColor="#0000CC" />
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.
Response.Redirect(ResolveC
End Sub
There are still problems. While It does go to the destination page url, the username that is supposed to display on the page does not show and also the login status displays "login", instead of "logout". It seems that redirecting in the login authentication event does not log the user in.
Below are code snippets for the loginview and loginstatus that are on the destination page url.
LoginView
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
Welcome,
</LoggedInTemplate>
</asp:LoginView>
<asp:LoginName ID="LoginName1" runat="server" />
LoginStatus
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutAction="RedirectToLo
Font-Size="Small" ForeColor="#0000CC" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.