Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Problems with the ReturnURL

Posted on 2010-08-30
6
Medium Priority
?
659 Views
Last Modified: 2012-05-10
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="RedirectToLoginPage" 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="Forgot Password?"
                                        PasswordRecoveryUrl="~/gp.aspx"
                                        DestinationPageUrl="~/useraccount.aspx">
                                    </asp:Login>

Thanks in advance.
0
Comment
Question by:mj168
  • 3
  • 3
6 Comments
 
LVL 7

Expert Comment

by:urir10
ID: 33562568
have u chekced that <authentication> tag in web.config file?
0
 

Author Comment

by:mj168
ID: 33562746
Below is my <authentication> tag.

<authentication mode="Forms">
0
 

Author Comment

by:mj168
ID: 33562762
Ignore the above. Below is my <authentication> tag.

<authentication mode="Forms">
   <forms defaultUrl="login.aspx" />
</authentication>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:urir10
ID: 33567699
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));

}

Open in new window

0
 

Author Comment

by:mj168
ID: 33570003
I tried the code you gave:

Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
        Response.Redirect(ResolveClientUrl(Login1.DestinationPageUrl))
    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="RedirectToLoginPage" Font-Bold="True" Font-Names="Arial"
                            Font-Size="Small" ForeColor="#0000CC" />
0
 
LVL 7

Accepted Solution

by:
urir10 earned 2000 total points
ID: 33570266
that means that the user is not actually Authenticated. try to follow the below article to actually Authenticate the user for your site, im just not sure how u have your setup for users working but that should give u an idea

http://www.netomatix.com/Development/LoginControlBasic.aspx
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question