Ask a Question related to ASP.NET Security, Design and Development.
-
Eric Newton #1
Re: How to set redirect default on login?
Sorry, FormsAuthentication is hard set to "default.aspx" when doing the
RedirectFromLoginPage and/or GetRedirectUrl [which is called by
RedirectFromLoginPage]
Just execute SetAuthCookie and then if Request.QueryString["ReturnUrl"] is
null, then redirect to where you want:
if( [password check passed )
{
FormsAuthentication.SetAuthCookie( [username], [create persistent
cookie] );
string returnUrl = Request.QueryString["ReturnUrl"];
if( returnUrl == null || returnUrl.Length < 1 )
returnUrl = "default.aspx";
Response.Redirect( returnUrl, true );
}
--
Eric Newton
[email]eric@ensoft-software.com[/email]
C#/ASP.net Solutions developer
"Lauchlan M" <LMackinnon@Hotmail.com> wrote in message
news:e4J1zVwZDHA.2960@tk2msftngp13.phx.gbl...instead> I want to set the default value for where
>
> FormsAuthentication.RedirectFromLoginPage
>
> sends you if it doesn't have a return value already.
>
> eg after lgin you might wat to send them to /mysecurearea/main.aspx> of default.aspx.
>
> At the moment it always defaults to default.aspx.
>
> Thanks!
>
> Lauchlan M
>
>
Eric Newton Guest
-
Login Redirect
Hi, all I have this login script that calls on itself to authenticate the username and the password. It redisplays the login page if there is an... -
Cookie not set after login and redirect
Hello I have setup a forms authentication login page and use custom principal and identity. When authenticate everything goes well. But when I set... -
login redirect doesn't work
Hello, I'm working on a asp.net/C# project, but I haven't got a lot of experience with programming with C# and the dotnet framework. I've build... -
best way to redirect asp to login htm page?
Hello, I need users to access a data entry asp page via a login page. If they bookmark the data entry asp I want to redirect them to the login... -
User Login to Redirect using PHP
I've read many posts about redirecting a user by specifying the directin url in the database, but have had very little luck. I'm using Dreamweaver's... -
Lauchlan M #2
Re: How to set redirect default on login?
This is silly design on MS's part IMO.
If I have a page Login.aspx and use
FormsAuthentication.RedirectFromLoginPage it _has_ to go to a default.aspx
in the same directory, and so _cannot_ go to my secure folder. So I end up
with a default.aspx that just redirects to where I really want it to go
which seems like (and is) a cludge.
And what would happen if my login page _was_ default.aspx? Would it just
cycle around to itself on successful login?
Sometimes the .net framework is amazing, sometimes you wonder whether MS
really thought about any of this.
Lauchlan M
> Sorry, FormsAuthentication is hard set to "default.aspx" when doing the
> RedirectFromLoginPage and/or GetRedirectUrl [which is called by
> RedirectFromLoginPage]
>
> Just execute SetAuthCookie and then if Request.QueryString["ReturnUrl"] is
> null, then redirect to where you want:
>
> if( [password check passed )
> {
> FormsAuthentication.SetAuthCookie( [username], [create persistent
> cookie] );
> string returnUrl = Request.QueryString["ReturnUrl"];
> if( returnUrl == null || returnUrl.Length < 1 )
> returnUrl = "default.aspx";
> Response.Redirect( returnUrl, true );
> }
Lauchlan M Guest
-
Eric Newton #3
Re: How to set redirect default on login?
I agree, there are parts of individual classes where some methods are well
written and thought out, and other methods are just silly...
GetRedirectUrl is one of them, it takes two parameters but doesnt even TRULY
use them [it checks the username to see if null and just returns a null if
so]
In my code, if I use GetRedirectUrl You'll frequently see "string url =
FormsAuthentication.GetRedirectUrl("SILLY_BOGUS_US ERNAME_HERE", false)
--
Eric Newton
[email]eric@ensoft-software.com[/email]
C#/ASP.net Solutions developer
"Lauchlan M" <LMackinnon@Hotmail.com> wrote in message
news:%239cwOa2ZDHA.1580@tk2msftngp13.phx.gbl...up> This is silly design on MS's part IMO.
>
> If I have a page Login.aspx and use
> FormsAuthentication.RedirectFromLoginPage it _has_ to go to a default.aspx
> in the same directory, and so _cannot_ go to my secure folder. So I endis> with a default.aspx that just redirects to where I really want it to go
> which seems like (and is) a cludge.
>
> And what would happen if my login page _was_ default.aspx? Would it just
> cycle around to itself on successful login?
>
> Sometimes the .net framework is amazing, sometimes you wonder whether MS
> really thought about any of this.
>
> Lauchlan M
>> > Sorry, FormsAuthentication is hard set to "default.aspx" when doing the
> > RedirectFromLoginPage and/or GetRedirectUrl [which is called by
> > RedirectFromLoginPage]
> >
> > Just execute SetAuthCookie and then if Request.QueryString["ReturnUrl"]>> > null, then redirect to where you want:
> >
> > if( [password check passed )
> > {
> > FormsAuthentication.SetAuthCookie( [username], [create persistent
> > cookie] );
> > string returnUrl = Request.QueryString["ReturnUrl"];
> > if( returnUrl == null || returnUrl.Length < 1 )
> > returnUrl = "default.aspx";
> > Response.Redirect( returnUrl, true );
> > }
>
Eric Newton Guest
-
Lauchlan M #4
Re: How to set redirect default on login?
Heh heh.
You might get caught out with that when the framework changes <g>
Lauchlan M
TRULY> GetRedirectUrl is one of them, it takes two parameters but doesnt even> use them [it checks the username to see if null and just returns a null if
> so]
>
> In my code, if I use GetRedirectUrl You'll frequently see "string url =
> FormsAuthentication.GetRedirectUrl("SILLY_BOGUS_US ERNAME_HERE", false)
Lauchlan M Guest



Reply With Quote

