468,549 Members | 2,309 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,549 developers. It's quick & easy.

HttpContext.Current.User.Identity.Name loses value

Hi,
I am using HttpContext.Current.User.Identity.Name to get a user id
from a web application. I then use that as part of a name of a cookie
I'm writing. 30 minutes later I do a refresh of this page and try to
access that cookie. However, because I am using
HttpContext.Current.User.Identity.Name to get the user id to know what
that cookie name even is, I am having problems because apparently
after 30 minutes HttpContext.Current.User.Identity.Name is no longer
returning a value. I think it has something to do with session
information only being available for 20 minutes by default.

Is there another way to get the user id other than
HttpContext.Current.User.Identity.Name?

Apr 30 '07 #1
4 9686
in asp.net, authentication is independent of session. if its not set,
then you page is not requiring authentication.

-- bruce (sqlwork.com)

Doogie wrote:
Hi,
I am using HttpContext.Current.User.Identity.Name to get a user id
from a web application. I then use that as part of a name of a cookie
I'm writing. 30 minutes later I do a refresh of this page and try to
access that cookie. However, because I am using
HttpContext.Current.User.Identity.Name to get the user id to know what
that cookie name even is, I am having problems because apparently
after 30 minutes HttpContext.Current.User.Identity.Name is no longer
returning a value. I think it has something to do with session
information only being available for 20 minutes by default.

Is there another way to get the user id other than
HttpContext.Current.User.Identity.Name?
Apr 30 '07 #2
I'm not dealing with authentication. I'm trying to read the value in
that HttpContext.Current.User.Identity.Name value and it goes away
after 30 minutes. First time I go through it's there.
Apr 30 '07 #3
Doogie wrote:
Hi,
I am using HttpContext.Current.User.Identity.Name to get a user id
from a web application. I then use that as part of a name of a cookie
I'm writing. 30 minutes later I do a refresh of this page and try to
access that cookie. However, because I am using
HttpContext.Current.User.Identity.Name to get the user id to know what
that cookie name even is, I am having problems because apparently
after 30 minutes HttpContext.Current.User.Identity.Name is no longer
returning a value. I think it has something to do with session
information only being available for 20 minutes by default.

Is there another way to get the user id other than
HttpContext.Current.User.Identity.Name?
There's Request.ServerVirables("AUTH_USER") (or LOGON_USER i believe,
which gives same result if i remember correctly)
However, this property also comes out of httpcontext:

HttpContext.Current.ApplicationInstance.Request.Se rverVirables("AUTH_USER")

I don't know if that will solve you problem or not.
Apr 30 '07 #4
Since it's part of HttpContext I'm guessing it'll be an issue as well,
but thank you. I did find out that if I do my refresh before the 20
minutes (say every 15), I don't lose that info in the HttpContext
object. It stays for quite some time (until my cookie expires and I
have to reget all my info then it goes away). Not sure why this is
but I think that's what I'll go with.

May 1 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Sjaakie | last post: by
2 posts views Thread by Abraham Andres Luna | last post: by
reply views Thread by =?Utf-8?B?QW50b25pbyBPJydOZWFs?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.