Solved

Problems with the ReturnURL

Posted on 2010-08-30
6
644 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now