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
Solved

Forms Authentication - RedirectFromLoginPage Is Null

Posted on 2004-04-16
3
366 Views
Last Modified: 2012-06-21
I have a question which nobody seems to be able to answer - even the teacher on the ASP.NET course I have recently been on.

When using forms authentication, if the user manages to navigate himself straight to the login page, RedirectFromLoginPage is null and after a successful login it goes to the root default.aspx, even if you dont want it to!!! And you cant seem to change this.  So my question is, can you change this?  I want it to go the sub folder default.aspx, not the root default.aspx.

0
Comment
Question by:BlueEdger
3 Comments
 
LVL 10

Accepted Solution

by:
EBatista earned 125 total points
ID: 10841286
try comparing the GetRedirectUrl property with String.Empty:

If Not FormsAuthentication.GetRedirectUrl = String.Empty Then
   Server.Transfer ("/SubFolder/Default.aspx" )
End If

or

If FormsAuthentication.GetRedirectUrl = String.Empty Or FormsAuthentication.GetRedirectUrl = "Default.aspx" Then
         Server.Transfer ("/SubFolder/Default.aspx" )        
        Else
         FormsAuthentication.RedirectFromLoginPage (UserName.Value, True)
End If

regards
0
 
LVL 1

Author Comment

by:BlueEdger
ID: 11096020
Sorry, have been meaning to close my open questions for some time.

In the end, due to project time constraints, I gave up using forms authentication in the end, and just did the authentication myself - much easier!  So thanks Microsoft but as usual you've only come up with a half baked solution that doesnt work in the real world!

I must admit that I have not tested EBatista's solution (sorry I do appreciate your help), but am happy to award you the points.

Apologies for my lack of attentiveness.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
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…

856 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