Can not get user name from HttpContext.Current.User.Identity.Name

Hi All;

I have tried to use HttpContext.Current.User.Identity.Name to get window user account. However, from debugger, for a long time ago I saw my window user name. But now, I did not see my window user name (from debugger) with the same code and same function call.
Please help. Was I doing something wrong? Or any special settings on web.config/machine.config or project to make it work??? I'm stuck
Thanks a lot

4/19/2004 9:25:27 PM 27051 articles. 1 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 34

well, you have to have windows integrated authentiction enabled in IIS, IIRC.
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable

Jason Brown - MVP, IIS
4/20/2004 8:16:31 AM
Did you use Forms login ?
Tim *IceMan* Musschoot

Software Engineer

AspNL Moderation Team
4/20/2004 10:27:57 AM
yes, I've used form login,  but I also used window login as the first step to see if user has window account.  if user has a window account, he/she will be in automatically, if not, user will be redirected to logon page
4/20/2004 2:15:05 PM

Similar Artilces:

difference between HttpContext.Current.User.Identity.Name and User.Identity.Name
Q1. what is the difference between 1. HttpContext.Current.User.Identity.Name;and 2. User.Identity.Name Q2.i'm using 2.0. i'm using the following code to authenticate FormsAuthentication.RedirectFromLoginPage(strEMail, false); Response.Redirect("web/ra.aspx"); my main web.config has <authentication mode="Forms">      <forms          name=".ASPXAUTH"          loginUrl="back.htm"          protection="All" &n...

Get Unique Princial Name into HTTPContext.Current.User.Identity.Name
Our apps use a variation of integrated and digest. A new standard for our org is to enable users to login via their UPN (Unique Principal Name).  The PreWindows 2000 username is something that doesn't make sense.  For example on accounts Account:     UPN:    PreWindows2000:  rxb3930220 The PreWindows2000 is being generated from a program that creates these accounts.  And the users do not know what their pre-windows 2000 username is. If one of our apps use IIS Digest, the HTTPContext.Current.User.Ident...

Separting the User name from the Machine name in User.Identity.Name
string userNameWithMachineName = User.Identity.Name; string userNameWithoutMachineName = System.IO.Path.GetFileName(userNameWithMachineName); HighOnCodingWanna get high! ...

Register a user in the HttpContext.Current.User.Identity.Name
We need to somehow register an AD authenticated username into the HttpContext.Current.User object.  I found the following code somewhere here in these forums a while ago. I can't recall who posted it but please accept my appreciation. But I'm unsure how to actually use it to assign a new user. Can someone maybe point out how to do this?  1            HttpContext context = HttpContext.Current;2            // Get the service provider from the context3  &...

how to get the user group name by HttpContext.Current.User?
Is it possible to get the domain user group name or role name on domain server by HttpContext.Current.User?For example, I want to identify if the user belongs to group myDomain/Administrators, I try to use User.IsInRole("myDomain/Administrators"), but I failed.One user maybe join multiple groups. How to get the all groups in code for current user?  Demo code for C# and VB please.   Try using this instead: VB: If Page.User.IsInRole("DOMAIN\GROUPNAME") C# If Page.User.IsInRole("DOMAIN\\GROUPNAME") Note, this will only work if you have ...

Problem in getting logged in user Name for ASPX page with (even with this.User.Identity.Name)
Hi  friends,  I am creating an application that takes current logged in user and displays on the page itself. for this I am getting the user name in PageLoad function by using this.User.Identity.Name and then storing the value in a hidden variable for aspx page. I am using this hidden  variable to display the name of the user. I am using Windows authentication for this. Now problem that I am getting is that when multiple user launch the application from different machine and if they click simultaneously, name of one user appears on the paged displayed on the machine of ot...

getting HttpContext.Current.User.Identity.Name as blank
Hi All, In my project ,in web.config  am using <authentication mode="Forms"> <forms loginUrl="~/login.aspx" name="AuthCookie" timeout="60" path="/"></forms> </authentication>  <sessionState mode="InProc" stateConnectionString="tcpip=" sqlConnectionString="data source=;Trusted_Connection=yes" cookieless="false" timeout="60"/>   In WebPage am trying to get the Logged in UserId with HttpContext.Current.User.Identity.Name...

Getting the user name of the currently logged in user
I'm writing my first custom module. Just as an experimental project I would just display information about the currently logged in user. I can get the User Id, but I don't know where to get the rest of the information. How do I get this? Hi, Just create a new UserController to get the information about one user via the method GetUser(PortalId, UserId) and store it into a UserInfo. Then you can get the rest of the information from this UserInfo [VB] Dim myUser As New UserInfo Dim myUserController As New UserController myUser = myUserController.GetUser(PortalId, Use...

User.Identity.Name returns email address instead of user name
I have modified the login control so that the user logs in using their email instead of their user name. Here is my code:Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate Dim email As String = Login1.UserNameDim userName As String = Membership.GetUserNameByEmail(Login1.UserName)Dim userInfo As AdditionalUserInfo = New AdditionalUserInfo   If Membership.ValidateUser(userName, Login1.Password) = True ThenDim isFirstTime As Boolean = userInfo.GetUserInfo(userName).IsFirstTime If isFirstTi...

What has to happen after login before Page.User.Identity.Name contains the user name?
I am using Membership Services in my new ASP.NET 3.5 app. I want to redirect the user to a page where he can enter various personal details if he has not yet done this. I put some VB.NET code in the LoggedIn event for my Login control that depends on the availability of the current user name in Page.User.Identity.Name but this reference is Nothing at this stage in the process. Page.User.Identity.Name works fine on other pages. When exactly is Page.User.Identity.Name loaded with the name of the current user?David   The authentication process hapen like this... 1-User request a secur...

can not get User.Identity.Name
Hi I have 2 pages in virtual directory. admin.aspx and update.aspx. I am using Windos XP I am using authentication mode="Forms. in the web.config i have <authentication mode="Forms"> <forms loginUrl="admin.aspx"> <credentials passwordFormat="Clear"> <user name="claudio" password="vargas" /> <user name="coffe" password="dance" /> </credentials> </forms> .... When I log in by giving the userName and password starting the admin.aspx the authentication works fine and goes to update.aspx as I expected. In the page update.aspx i control t...

This displays domain/user.  I need only to get the username.  How can i get the username without the domain. name without the other information? the value returned is a string so you could do a substring like this: dim uname as string = len as integer = uname.lengthdim slashat as integer = uname.indexof("/")dim onlyname as string = uname.substring((slashat+1), (me.length-shashat)) then onlyname is the just the name portion, no domain or slash with it...the code is quick off my head but I think it will least ...

Win 2003 web server on LAN with iis 6.0 and .net 2.0 doesn't return HttpContext.Current.User.Identity.Name value
Hi. I'm accessing a Win 2003 web server on LAN with iis 6.0 and .net 2.0 that doesn't reuturn HttpContext.Current.User.Identity.Name value in 2.0 c# although I am logged on to the network domain.  Any advice on why and how to rectify this? The web.config file has authentication mode="Windows" set.  Thanks for any help!...

HttpContext.Current.User.Identity.Name and cookies
Hi Folks, We are setting cookies on our site so anonymous visitors can save items for a quote:  The cookies are set using:GUID = System.Guid.NewGuid().ToString();FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(1,GUID,DateTime.Now,DateTime.Now.Add(new TimeSpan(365, 0, 0, 0)),true,String.Empty,FormsAuthentication.FormsCookiePath);string encTicket = FormsAuthentication.Encrypt(newTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);authCookie.Expires = DateTime.Now.Add(new TimeSpan(365, 0, 0, 0));Response.Cookies.Add(authCo...

Web resources about - Can not get user name from HttpContext.Current.User.Identity.Name -

User Will - Stack Overflow
current community chat blog Stack Overflow Meta Stack Overflow Stack Overflow Careers your communities Sign up or log in to customize your list. ...

OPAC Discovery
Switch Language To switch to a different language, select from the following list: English French Spanish Italian British Bulgarian Galician ...

Daniel Hoelbling-Inzko's Blog about programming and shiny things
Tigraine Daniel Hoelbling-Inzko talks about programming Home Articles About me Articles Over the years I accumulated a number of (at least sometimes) ...

Blog archive - Splinter Software
Chris Hulbert, Splinter Software, is a freelance iOS developer based in Sydney, Australia.

Unobtrusive AJAX with ASP.NET MVC
... class ReturnJsonForAjaxRequests : ActionFilterAttribute { public bool FollowRedirects = true; public static Func new HttpRequestWrapper(Htt ... MVC增加全局异常捕获500、404错误
/// /// 错误日志(Controller发生异常时会执行这里) /// public class AppHandleErrorAttribute : HandleErrorAttribute { /// /// 异常 /// /// public override void ...

ARCC :: About Ares Capital :: Product Offerings Session state has created a session id, but cannot save ...
... but cannot save it because the response was already flushed by the application.] System.Web.SessionState.SessionIDManager.SaveSessionID(HttpContext ...

Job Search Canada - Employment Opportunities Site - Find & Post Jobs Online
Find and post jobs online - search for jobs across Canada, read the latest employment news articles, get career tips and advice at Canada's top ...

... Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context ...

Our “Opinions” on the ASP.NET MVC (Introducing the Thunderdome Principle)
I’ve got my asbestos underwear on, so flame away… So many of us are so thrilled at seeing an official Front Controller / MVC framework for ASP.NET ...

Resources last updated: 1/17/2016 6:34:57 AM