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 asp.net 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: firstname.lastname@example.org 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:
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
In my project ,in web.config am using <authentication mode="Forms">
<forms loginUrl="~/login.aspx" name="AuthCookie" timeout="60" path="/"></forms>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;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?
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
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
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
<user name="claudio" password="vargas" />
<user name="coffe" password="dance" />
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...HttpContext.Current.User.Identity.Name()
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 = httpcontext.current.user.identity.name()dim 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 included...play with it...the code is quick off my head but I think it will work...at 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 asp.net 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
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...