473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Forms Auth cookie vanishes immediately after login

23s
I had this problem in the past, after a server reformat it went away, and
now after another server reformat it's back again - no clue what's doing it.
Here's the flow:

Website root is public, no SSL no forms auth. One of the subfolders in the
public area is the root of a "protected" area; SSL is required from this
subfolder on forward and a web.config in the subfolder specifies forms
authentication. From the public area, I provide a link to a "welcome" page
in the protected area - if welcome page is requested, user is bounced to
login.aspx, and if successful login (integrated with AD) they get the
welcome page.

This part works, I can arrive to the site, request the protected "welcome"
page, get the login.aspx, log in with my AD creds, and get the welcome page.
Turning trace on shows the forms auth cookie to exist on the welcome page.
Because I am integrated with AD I'm using role-based security in web.configs
and so I'm impersonating in every subsequent request. On the next request,
the forms auth cookie is gone when Authenticate_Request fires. AFAIK I
don't have any code between the output of the trace on "welcome" page and
the Authenticate_Request in global.asax. The cookie is being destroyed
sometime after I login and the welcome page is delivered, but I can't figure
out where or by what.

Consequently, the only part of my secure area I can access is the welcome
page. Once I'm there, my cookie goes bye-bye and any requests in the
protected area simply bounce me to the login screen again.

What would cause a cookie be created and then seemingly disappear once I'm
logged in? The website code is stored in VSS and hasn't changed in months;
this code was working last week before I reformatted the web server, so I'm
suspecting a server configuration issue - the web.configs may have changed,
although I cannot seem to find anything wrong with them.
Nov 18 '05 #1
4 5599
are these pages all on the same domain name (as far as the browser knows)?

also, have you set the path of the Forms Authentication cookie so that all the pages can read it. "/" works best

--Michael

"23s" <as**@asdf.com> wrote in message news:qZ********************@speakeasy.net...
I had this problem in the past, after a server reformat it went away, and
now after another server reformat it's back again - no clue what's doing it.
Here's the flow:

Website root is public, no SSL no forms auth. One of the subfolders in the
public area is the root of a "protected" area; SSL is required from this
subfolder on forward and a web.config in the subfolder specifies forms
authentication. From the public area, I provide a link to a "welcome" page
in the protected area - if welcome page is requested, user is bounced to
login.aspx, and if successful login (integrated with AD) they get the
welcome page.

This part works, I can arrive to the site, request the protected "welcome"
page, get the login.aspx, log in with my AD creds, and get the welcome page.
Turning trace on shows the forms auth cookie to exist on the welcome page.
Because I am integrated with AD I'm using role-based security in web.configs
and so I'm impersonating in every subsequent request. On the next request,
the forms auth cookie is gone when Authenticate_Request fires. AFAIK I
don't have any code between the output of the trace on "welcome" page and
the Authenticate_Request in global.asax. The cookie is being destroyed
sometime after I login and the welcome page is delivered, but I can't figure
out where or by what.

Consequently, the only part of my secure area I can access is the welcome
page. Once I'm there, my cookie goes bye-bye and any requests in the
protected area simply bounce me to the login screen again.

What would cause a cookie be created and then seemingly disappear once I'm
logged in? The website code is stored in VSS and hasn't changed in months;
this code was working last week before I reformatted the web server, so I'm
suspecting a server configuration issue - the web.configs may have changed,
although I cannot seem to find anything wrong with them.

Nov 18 '05 #2
23s
On the same domain - it's not too big, the entire structure looks like this:

<website root folder> website starts here in IIS
----[web.config] (let anyone in, no auth req'd)
----[content]
----<securesite subfolder> new app in IIS + req's SSL
--------[web.config] (use forms auth, path="/")
--------[login.aspx]
--------[index.aspx] ("welcome" page, public side requests to enter
securesite)
--------<securesite area 1 subfolder>
------------[web.config] (allowed/denied roles)
------------[content]
--------<securesite area 2 subfolder>
------------[web.config] (allowed/denied roles)
------------[content]
--------<about 12 more areas, structured alike>

So from the public http/80 side, user requests securesite/index.html on the
https/443 side in the "securesite" app root; the forms auth in the
securesite app sees the user is not logged in yet and gives them login.aspx.
User enters creds, login.aspx page makes an .ASPXAUTH cookie on their client
and redirects to index.aspx - global.asax impersonates, index.aspx is
delivered, trace shows .ASPXAUTH exists, all appears well.

Next request to (pick any) "<securesite area X subfolder>" sends you back to
login.aspx - .ASPXAUTH cookie is *not* listed in the trace data, only
ASP.NET_SessionID remains in the cookies. The SessionID stays consistant as
you play with this so I think it's retaining the session data OK. But for
some reason the browser is throwing out .ASPXAUTH? I've got my browser
security completely bottomed out for the purposes of testing this and it
doesn't seem to matter. Using the same code that worked a few weeks ago -
can this be a server config issue? Web.config problem? Timeouts on session
& forms auth in web.config are set to 30 mins.

"Raterus" <ra*****@spam.org> wrote in message
news:u3**************@TK2MSFTNGP12.phx.gbl...
are these pages all on the same domain name (as far as the browser knows)?

also, have you set the path of the Forms Authentication cookie so that all
the pages can read it. "/" works best

--Michael

"23s" <as**@asdf.com> wrote in message
news:qZ********************@speakeasy.net...
I had this problem in the past, after a server reformat it went away, and
now after another server reformat it's back again - no clue what's doing it. Here's the flow:

Website root is public, no SSL no forms auth. One of the subfolders in the public area is the root of a "protected" area; SSL is required from this
subfolder on forward and a web.config in the subfolder specifies forms
authentication. From the public area, I provide a link to a "welcome" page in the protected area - if welcome page is requested, user is bounced to
login.aspx, and if successful login (integrated with AD) they get the
welcome page.

This part works, I can arrive to the site, request the protected "welcome"
page, get the login.aspx, log in with my AD creds, and get the welcome page. Turning trace on shows the forms auth cookie to exist on the welcome page.
Because I am integrated with AD I'm using role-based security in web.configs and so I'm impersonating in every subsequent request. On the next request, the forms auth cookie is gone when Authenticate_Request fires. AFAIK I
don't have any code between the output of the trace on "welcome" page and
the Authenticate_Request in global.asax. The cookie is being destroyed
sometime after I login and the welcome page is delivered, but I can't figure out where or by what.

Consequently, the only part of my secure area I can access is the welcome
page. Once I'm there, my cookie goes bye-bye and any requests in the
protected area simply bounce me to the login screen again.

What would cause a cookie be created and then seemingly disappear once I'm
logged in? The website code is stored in VSS and hasn't changed in months; this code was working last week before I reformatted the web server, so I'm suspecting a server configuration issue - the web.configs may have changed, although I cannot seem to find anything wrong with them.

Nov 18 '05 #3
23s
Correction to the above post:
So from the public http/80 side, user requests securesite/index.html on

the

it's index.aspx, not index.html; all pages are .aspx files monitored by
asp.net/forms auth.
Nov 18 '05 #4
Here is how I fixed my "dissapearing cookie" problem. I set up another
forms authentication website, as basic as possible (everything in root
directory at first), get that working, then gradually move that project
toward a configuration like your current project (move pages to same
directories, same web.config settings, etc), eventually one of two things
will happen, it'll stop working, and you'll know exactly what you did that
caused that to happen, or it will work great and you'll be stumped about
what is the difference <-- if this happens, just copy everything over from
the text project to the real project, and it should work.

It's a little time consuming yeah, but this helped me figure out exactly
what the problem was when I was troubleshooting one of my forms
authentication applications..

"23s" <as**@asdf.com> wrote in message
news:We********************@speakeasy.net...
Correction to the above post:
So from the public http/80 side, user requests securesite/index.html on

the

it's index.aspx, not index.html; all pages are .aspx files monitored by
asp.net/forms auth.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gary Chamberlain | last post by:
I have a C# aspx application. I also have a VB aspx application for forums. I made the forums as sub web of the main one. It is in a folder called /forums. Because it is a VB app it is running...
2
by: george d lake | last post by:
Hi, I have several company sites (a1.company.com, a2.company.com, a3.company.com, etc). Each site used a custom Forms Auth (all use the same code). I have been ask if there could be just one login...
2
by: Brad | last post by:
Stupid question time: Why does Forms Auth just keep going to the login page when access is denied? A 403 error is never raised..at least in my testing it doesn't. If I have a particular web...
3
by: Mike | last post by:
I have a web application that the forms authentication cookie is not expiring correctly. When I look at the trace information of a newly requested page after the session and forms authentication have...
1
by: Bijoy Naick | last post by:
I have a folder on my site secured with Forms Authentication. After the user is authenticated, I set a session level variable. The session time on the server is set to 20 mins. I am guessing the...
3
by: Paul W | last post by:
Using Forms Authentication, I'd like to 'piggy-back' a small piece of information onto the authentication cookie. I tried the following, but this seems to invalidate the cookie, so...
4
by: dhnriverside | last post by:
Hi guys Ok, I have a website which has an "Artists Only" section, for which you have to login for. This section is contained within its own directory on the server "/aonly". I want to make...
3
by: HIK | last post by:
I have an ASP.NET application on a Win2k3 server. The user is directed to form B (with a query string that contains the logon information). Form B refers to Form A which validates the user...
6
by: IntraRELY | last post by:
I have an WinForm (VB.NET) that is launched from an ASP.NET page that uses Form Authentication. After the WinForm is lauched it calls a web service. I want to use the credentials stored in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.