Re: FormsAuthentication.RedirectFromLoginPage

From: Bill Borg (BillBorg_at_discussions.microsoft.com)
Date: 02/16/05


Date: Wed, 16 Feb 2005 13:47:04 -0800


*This might be a double-post (having system trouble), but here goes (again):*

Looks pretty good at first blush. Any chance there's a web.config in the
subfolder too (that would override the root)?

Also, per your comment above, I'll be anxious to read Steve's response. I've
been working through all this same stuff lately. To me, redirectfromloginpage
is one of those times where asp.net does *too* much to make it easy, so you
don't really understand what's happening underneath. Afaik, it combines
creating the cookie, creating the authentication ticket stored in the cookie,
persisting them or not, and redirecting to the requested page. You can do all
these yourself if you understand what's happening, and you're forced to do
that in cases I run into all the time, such as wanting to name the cookie
myself, keeping multiple cookies, playing with timeout values per user, etc.
Best discussion I've seen of all this is in Esposito's Programming ASP.NET
(best discussion of most *anything* is in that book). There's also a ton of
great stuff in this forum.

Bill

"Andy Sutorius" wrote:

> Bill,
>
> Thanks for that. I forgot to put in an allow. This is what my web.config
> looks like now. And I am still getting the same response. I am attempting to
> control access into a subdirectory from the web.config in the root folder.
> Any other ideas?
>
> <location path="admin" allowOverride="false">
> <!-- <location path="admin" allowOverride="true"> -->
> <system.web>
> <authorization>
> <deny users="?" />
> <allow users="*" />
> </authorization>
> </system.web>
> </location>
>
>
> "Bill Borg" <BillBorg@discussions.microsoft.com> wrote in message
> news:2D435316-86B8-4AB5-9792-3110F7C1F9FF@microsoft.com...
> > Steve, doesn't the redirectfromloginpage call create the cookie for you?
> >
> > Andy, I've also had this when my web.config is not set up correctly to
> deny
> > anonymous users and *allow* authenticated users.
> >
> > Bill
> >
> > "Steve C. Orr [MVP, MCSD]" wrote:
> >
> > > It looks like you've forgotten to call SetAuthCookie.
> > > Here's more info:
> > >
> http://authors.aspalliance.com/aspxtreme/sys/Web/Security/FormsAuthenticationClassSetAuthCookie.aspx
> > >
> > > --
> > > I hope this helps,
> > > Steve C. Orr, MCSD, MVP
> > > http://SteveOrr.net
> > >
> > >
> > > "Andy Sutorius" <andy@sutorius.com> wrote in message
> > > news:%sLQd.69593$dt3.7467733@twister.southeast.rr.com...
> > > > Hi,
> > > >
> > > > For some reason the login.aspx webpage redirects to itself after a
> > > > successful login and not to the url in the address bar. I have stepped
> > > > through this with debug and it behaves as it is supposed to. What am I
> > > > overlooking? Try it.
> > > >
> > > > http://www.sutorius.com/psyche
> > > > click the Administration link
> > > > username = user1
> > > > password = user1
> > > >
> > > >
> > > > private void cmdLogin_ServerClick(object sender, System.EventArgs e)
> > > > {
> > > > if (ValidateUser(txtUserName.Value,txtUserPass.Value) )
> > > >
> > > >
> > > >
> FormsAuthentication.RedirectFromLoginPage(txtUserName.Value,chkPersistCookie
> > > > .Checked);
> > > >
> > > > else
> > > >
> > > > lblMsg.Text = "Invalid Log in";
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
>
>
>



Relevant Pages

  • Re: SignOut a User
    ... Then, instead of calling RedirectFromLoginPage, call GetRedirectUrl. ... authentication cookie value. ... >Subject: Re: SignOut a User ... >as far as I know it doesn't matter how many connections there are, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: FormsAuthentication Cookie
    ... Also assume that the username of the ... Sub Page_Load ... Internet Files folder & click the cookie, I find that the cookie has ... first parameter in the methods RedirectFromLoginPage & GetAuthCookie? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: FormsAuthentication.RedirectFromLoginPage
    ... creating the cookie, creating the authentication ticket stored in the cookie, ... "Andy Sutorius" wrote: ... > control access into a subdirectory from the web.config in the root folder. ... doesn't the redirectfromloginpage call create the cookie for you? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: FormsAuthentication.RedirectFromLoginPage
    ... In fact there is a web.config in the subfolder ... with the same deny/allow so I took it out. ... > creating the cookie, creating the authentication ticket stored in the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Speaking of Girl Scout cookies
    ... of one 'Cookie Mom from Hell'. ... bill on the table.....looks at her and says 'this is what it cost me the ... still has that bill in his desk, as he knows someone else will ask ...
    (rec.food.cooking)