Ask a Question related to ASP.NET, Design and Development.
-
Dan Bart #1
Web.HttpContext.Current.User.Identity.Name is blank
I am using an application which is a modification of IBuySpy Portal.
It is using Forms authentication. Users login and their name is added
to
Context
Then I use:
Web.HttpContext.Current.User.Identity.Name
to write audit trail as to what users do. Now recently on one of the
activities I noticed that the
Web.HttpContext.Current.User.Identity.Name was blank. Which should not
have been possible?
Can someone please tell me why this could have happened? And how I can
prevent this?
Thanks,
db
Dan Bart Guest
-
flow user identity to web service through httpcontext??
hi all is there anyway to get access to the httpcontext of a web service call so that a custom principal object can be carried in the... -
HttpContext.Current.User.IsInRole
Hi, I have a problem when I am using the HttpContext.Current.User.IsInRole... This is my code: if (HttpContext.Current.User.IsInRole("Admin... -
How secure is HttpContext.Current.User.Identity.Name ?
How secure it is to authorize access to an ASP.NET application based on the value of the HttpContext.Current.User.Identity.Name propery? I... -
creating custom HttpContext.Current.User.Identity
I've started getting into using forms authentication for asp.net apps with c#. From what i understand so far (limited) I like the way things work!... -
HttpContext.Current.User not available in the redirected page
I am trying to use Forms Authentication and Role-Based Security: I have two pages: login.aspx and Default.aspx. -------------------------- This is... -
Teemu Keiski #2
Re: Web.HttpContext.Current.User.Identity.Name is blank
And it is put to the Context on every request i.e user is athenticated with
forms auth and then in Application_AuthenticateRequest you populate the
HttpContext with the Principal? I am asking because HttpContext is recreated
for every request which means that user details must also.
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Dan Bart" <dblist2003@yahoo.com> wrote in message
news:fa87ff30.0311191706.6105d46b@posting.google.c om...> I am using an application which is a modification of IBuySpy Portal.
> It is using Forms authentication. Users login and their name is added
> to
> Context
> Then I use:
>
> Web.HttpContext.Current.User.Identity.Name
>
> to write audit trail as to what users do. Now recently on one of the
> activities I noticed that the
>
> Web.HttpContext.Current.User.Identity.Name was blank. Which should not
> have been possible?
>
> Can someone please tell me why this could have happened? And how I can
> prevent this?
>
>
>
> Thanks,
>
>
>
> db
Teemu Keiski Guest
-
Dan Bart #3
Re: Web.HttpContext.Current.User.Identity.Name is blank
Yes it is put in the Context on every request in Global.asax.vb
Thanks,
db
> And it is put to the Context on every request i.e user is athenticated with
> forms auth and then in Application_AuthenticateRequest you populate the
> HttpContext with the Principal? I am asking because HttpContext is recreated
> for every request which means that user details must also.
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
>
>
> "Dan Bart" <dblist2003@yahoo.com> wrote in message
> news:fa87ff30.0311191706.6105d46b@posting.google.c om...> > I am using an application which is a modification of IBuySpy Portal.
> > It is using Forms authentication. Users login and their name is added
> > to
> > Context
> > Then I use:
> >
> > Web.HttpContext.Current.User.Identity.Name
> >
> > to write audit trail as to what users do. Now recently on one of the
> > activities I noticed that the
> >
> > Web.HttpContext.Current.User.Identity.Name was blank. Which should not
> > have been possible?
> >
> > Can someone please tell me why this could have happened? And how I can
> > prevent this?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > dbDan Bart Guest
-
Pete #4
Re: Web.HttpContext.Current.User.Identity.Name is blank
Hi Dan,
I notice this behaviour too but only after the initial authentication
request. Subsequent requests contain the expected user name.
--
Cheers
Pete
XBOX Live Leagues & Tournaments
[url]http://www.xboxracing.net/[/url]
"Dan Bart" <dblist2003@yahoo.com> wrote in message
news:fa87ff30.0311191706.6105d46b@posting.google.c om...> I am using an application which is a modification of IBuySpy Portal.
> It is using Forms authentication. Users login and their name is added
> to
> Context
> Then I use:
>
> Web.HttpContext.Current.User.Identity.Name
>
> to write audit trail as to what users do. Now recently on one of the
> activities I noticed that the
>
> Web.HttpContext.Current.User.Identity.Name was blank. Which should not
> have been possible?
>
> Can someone please tell me why this could have happened? And how I can
> prevent this?
>
>
>
> Thanks,
>
>
>
> db
Pete Guest
-
Andrea D'Onofrio [MSFT] #5
Re: Web.HttpContext.Current.User.Identity.Name is blank
To populate the LOGON_USER variable when you use any authentication mode
other than None, you can deny access to the Anonymous user in the
<authorization> section of the Web.config file and change the authentication
mode other then None.
NOTE: When you enable Anonymous authentication in conjunction with Windows
authentication <or> if you grant access to the Anonymous user in the
<authorization> section while you are using any authentication mode other
than None, other server variables such as AUTH_USER and REMOTE_USER (as well
as the HttpContext.Current.User.Identity.Name property) also return an
empty string. You can use the any of the above-mentioned resolutions to
populate these variables.
Please refer to this public article for any additional details:
306359 PRB: Request.ServerVariables("LOGON_USER") Returns Empty String in
[url]http://support.microsoft.com/?id=306359[/url]
HtH,
Andrea
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Pete" <pete denness a-t qsadotcodotuk> wrote in message
news:%2361dtpUxDHA.1760@TK2MSFTNGP10.phx.gbl...addedcontext that the code is running under. Context.User.Identity is the> Hi Dan,
>
> I notice this behaviour too but only after the initial authentication
> request. Subsequent requests contain the expected user name.
>
> --
> Cheers
>
> Pete
>
> XBOX Live Leagues & Tournaments
> [url]http://www.xboxracing.net/[/url]
> "Dan Bart" <dblist2003@yahoo.com> wrote in message
> news:fa87ff30.0311191706.6105d46b@posting.google.c om...> > I am using an application which is a modification of IBuySpy Portal.
> > It is using Forms authentication. Users login and their name is
user that asp.net recognizes - and this is not always the same. In
particular, if impersonation is off you'll get the app pool identity (or
ASPNET in IIS5) for WindowsIdentity; User.Identity will give the user name
regardless of impersonation.
>> > to
> > Context
> > Then I use:
> >
> > Web.HttpContext.Current.User.Identity.Name
> >
> > to write audit trail as to what users do. Now recently on one of the
> > activities I noticed that the
> >
> > Web.HttpContext.Current.User.Identity.Name was blank. Which should not
> > have been possible?
> >
> > Can someone please tell me why this could have happened? And how I can
> > prevent this?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > db
>
Andrea D'Onofrio [MSFT] Guest



Reply With Quote

