Solved

Problems with the ReturnURL

Posted on 2010-08-30
6
643 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
Comment Utility
have u chekced that <authentication> tag in web.config file?
0
 

Author Comment

by:mj168
Comment Utility
Below is my <authentication> tag.

<authentication mode="Forms">
0
 

Author Comment

by:mj168
Comment Utility
Ignore the above. Below is my <authentication> tag.

<authentication mode="Forms">
   <forms defaultUrl="login.aspx" />
</authentication>
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 7

Expert Comment

by:urir10
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

13 Experts available now in Live!

Get 1:1 Help Now