ASP.NET Forms authentication

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi folks,

I am currently using ASP.NET Forms authentication for a login system I
have built and I was wondering if there is some way that I can specify
the page that the user should be redirected to upon successful login?

The other thing I am wondering about is whether it is possible to stop
the user from being able to view pages after they logout and hit the
back button? I recall visiting websites in the past where when you log
out and hit the back button you get a message telling you that the page
has expired... Any ideas how this can be achieved in .NET?


Dylan Parry -- Where the Music Progressively Rocks!

Re: ASP.NET Forms authentication

Using a pointed stick and pebbles, Dylan Parry scraped:

Quoted text here. Click to load it

Well I can answer this one for myself :)

// Authorise the user
FormsAuthentication.SetAuthCookie(username.Value, false);
// Redirect to whatever page

Whereas before, I had:

FormsAuthentication.RedirectFromLoginPage(username.Value, false);

Which obviously authorises the user and then takes them back to where
they attempted to login from.

Dylan Parry -- Where the Music Progressively Rocks!

Site Timeline