• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

How to alter Membership DefaultURL in Code Behind..

Hi,

I have some cbh code which invokes the relevant start page as defined by defaultURL in Web.config.

<forms name=".ASPXFORMSAUTH" defaultUrl=AppStart.aspx" loginUrl="Login.aspx"/>

using

FormsAuthentication.RedirectFromLoginPage(currentUserName, Login1.RememberMeSet)

However on certain situations I want to redirect to another login page. I had expected to reassign the defaultURL value in the CBH ie

FormsAuthentication.defaultURL = "MyOtherLogin.aspx"
FormsAuthentication.RedirectFromLoginPage(currentUserName, Login1.RememberMeSet)

But this does not work since defaultURL is readonly.

Is it possible to do this and if so how?

Thanks,

Sam
0
SamJolly
Asked:
SamJolly
  • 4
2 Solutions
 
SamJollyAuthor Commented:
???? Explain please...... A bit too cryptic I am afraid...

What code should I use in the CBH..

Thanks,

Sam
0
 
SamJollyAuthor Commented:
Hi,

I have now sorted this.... So no further action required on this apart from closing. No points I am afraid due to no solution.

Sam
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
David RobitailleAnalyst ProgrammerCommented:
The solution I found for myself is to redirect the user within the page load of the "default login".

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
If Not Page.IsPostBack Then
    'here i test a condition, it could be a session variable or something like that  
    If something then
         Response.Redirect("~/login2.aspx")
    End If
End If 
End Sub 

Open in new window

0
 
SamJollyAuthor Commented:
Thanks for the input.... Since you spent the time and extended my knowledge you can have the points....

thnx,

Sam
0
 
SamJollyAuthor Commented:
thx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now