Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problems with the ReturnURL

Posted on 2010-08-30
6
Medium Priority
?
655 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

664 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