.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Imran Ghani
Post New Web Links

user.identity.name

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
 
when log in to the system its not taking user name  from  user.identity.name but in a design mode its wroking properly any clue Thanx Niranga  


View Complete Post


More Related Resource Links

User.Identity.Name returns blank

  
Hello, I have a strange problem when trying to get the user name. When I run the asp.net page from local machie it works, but when I run it from the server it doesn't. It's very strange, I have tryied with the following functions: Page.User.Identity.Name System.Web.HttpContext.Current.User.Identity.Name My.User.Name System.Threading.Thread.CurrentPrincipal.Identity.Name User.Identity.Name   All options returns blank :s when I run it in the server Anyone have had the same problem, that could help me please? Thanks in advance.    Also I have the following in web.config <identity impersonate="false"/>    <authentication mode="Windows"/>    <authorization>      <allow users="*" />      <deny users="?" />    </authorization>  and in the IIS enabled  the anonymus authentication and enabled windows authentication  

current user identity in custom security trimmer

  
The crux of my problem is that I want to impersonate  a user’s NTLM credentials in the context of a SharePoint custom security trimmer to execute HttpWebRequests to check user access to URLs.  When accessing WindowsIdentity.GetCurent() in the security trimmer, the System.Security.Principal.WindowsIdentity object returns the identity of the application pool running the search query service, NOT the currently logged in user.   When accessing System.Threading.Thread.CurrentPrinciple.Identity in the security trimmer, the Microsoft.IdentityModel.Claims.ClaimsIdentity object of the current logged in user is returned.  However, there is a catch.  …   If I execute the following code in a .NET web application, the cast of the ClaimsIdentity to a WindowsIdentity succeeds because the identity has the authentication type of NTLM.    WindowsIdentity winId = (WindowsIdentity)System.Threading.Thread.CurrentPrincipal.Identity; WindowsImpersonationContext wic = winId.Impersonate(); request.Credentials = CredentialCache.DefaultCredentials; //access means a response comes back when a request is made to the url using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { returnStatus = true; } wic.Undo(); However, when I execute the same code in the context of the SharePoint security trimmer (the search query service li

Why can't use 'user.identity.name' in masterpage code behind?

  
 I tried to use user.identity.name in a master page code behing  but intellisense doesn't recognize it.   If I change Inherits masterpage to inherit page then intellisense accepts it. What's going On?

user.identity.name="0" when uploading file using ajaxToolkit:AsyncFileUpload

  
hi, i am using AsyncFileupload to upload user picture. after the picture is uploaded and saved i opened another page and i noticed that the user.identity.name is lost. any idea 

httpcontext.current.user.identity.isauthenticated always false

  
Dear, please help me, I create two pages, the first one is the login page with user name and password textboxes - (not asp login control) , when clicking login button I check the login authentication, if it is true redirect to default page. in the default page if !IsCallBack then i check httpcontext.current.user.identity.isauthenticated if it is false i redirect the user to the login page. but my problem is that the httpcontext.current.user.identity.isauthenticated is always false. Below the section of authentication in web config < <authentication mode="Forms">forms loginUrl ="FrmUserLogin.aspx"  protection ="All"  timeout ="1"  name ="LoginRedirectCallback"  path ="/LoginRedirectCallback"  requireSSL ="false"  slidingExpiration ="true"  defaultUrl ="FrmDBLoginConfigaspx.aspx"  cookieless ="UseDeviceProfile"   < < </   </ </enableCrossAppRedirects ="false">credentials passwordFormat="Clear">user name ="admin" password ="admin"/>credentials>forms>authentication> thank you for any help.   Best Regards,

How to user Appol pool Identity for WCF authorization

  
One of my client has unique requirement.          Details Has Web application, WCF Service both are hosted in IIS6, and runs under a Domain Account (say MyAppAdmin) App_pool. Web application has anonymous access, and service is protected by Windows Authentication. Web App will calls the Service without any impersonation. So Serivice will be called by using App_pool Identity. Below is the code...objClient.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;objClient.ClientCredentials.Windows.AllowNtlm = true;objClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;objClient.Open();svcResult = objClient.MyMethod(input);Problem & requirement: App_pool user is coming to Service, able access using HttpContext.Current.User.Identity, with the properties IsAuthenticated=true; Name=MyAppAdmin. I need check, if this App_Pool user in an Active Directory Group or not. If he is part of allowed group then only I should allow to continue execution of method. For this I am using below codeWindowsIdentity wi = (WindowsIdentity)HttpContext.Current.User.Identity;PrincipalPermission permission = new PrincipalPermission(wi.Name, allowedRoleName, true);permission.Demand();But it is throwing Security.SecurityAccessDe

Master Page User.Identity.Name problem

  

Hello I've written some code to check information based on the authenticated user. The following code works on an ASPX page load but fails when I move into a Master Page. Specifically, the error is "Compiler Error Message: BC30451: Name 'User' is not declared."  

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

' Get & split Domain user Information

Dim strDomainUser As String = User.Identity.Name


page.formsauthentication.user.identity

  

what is the use formsAuthentication.user.identity


is it one of the property of page



How can I change identity of User Profile Sync Service?

  

1) I cannot remove duplicate managed account with remove-spmanagedaccount because this account is used by user profile synchronization service.

2) I cannot change the account in CA-Configure Service Accounts, it says "item has already been added..." because of duplicate managed account (1)

Is there a way of changing the account of user profile sync service so that it can be removed with remove-spmanagedaccount?

 


current user identity in custom security trimmer

  

The crux of my problem is that I want to impersonate  a user’s NTLM credentials in the context of a SharePoint custom security trimmer to execute HttpWebRequests to check user access to URLs. 

When accessing WindowsIdentity.GetCurent() in the security trimmer, the System.Security.Principal.WindowsIdentity object returns the identity of the application pool running the search query service, NOT the currently logged in user.  

When accessing System.Threading.Thread.CurrentPrinciple.Identity in the security trimmer, the Microsoft.IdentityModel.Claims.ClaimsIdentity object of the current logged in user is returned.  However, there is a catch.

 …

 

If I execute the following code in a .NET web application, the cast of the ClaimsIdentity to a WindowsIdentity succeeds because the identity has the authentication type of NTLM. 

 

WindowsIdentity winId = (WindowsIdentity)System.Threading.Thread.CurrentPrincipal.Identity;
WindowsImpersonationContext wic = winId.Impersonate();
request.Credentials = CredentialCache.DefaultCredentials;

//access means a response comes back when a request is made to the url

datareader not work when " where user.identity.name and date...?

  

 i don like this 

con =

con.Open()

cmd =

New SqlConnection("Data source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\mrhua\My Documents\Visual Studio 2010\WebSites\WebSite20\App_Data\De.mdf; Integrated Security=True;User Instance=True")New

User.Identity.Name returns app pool user instead of domain user

  

2 server web farm windows 2008 r2 nlb.  In IIS I enable windows authentication all other authentication is disabled.

 

code behind

       protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Response.Write(User.Identity.Name);
                Response.Write("<br/>");
                Response.Write("Auth user: " + Request.ServerVariables["Auth_User"]);
                Response.Write("<br/>");
                Response.Write("Logon user: " + Request.ServerVariables["LOGON_USER"]);
            }
        }

web.config

    <system.web>
        <authentication mode="Windows" />        
        <authorization>
            <deny users="?" />            
        </authorization>

        <compilation debug="true" targetFramework="4.0" />
    </system.web>



The code returns the application pool custom account e.g. DOMAIN\WebApp_user.  What I want is the logged in user's username.  How do I get this? 


User.Identity.Name poblem

  

I'm sure there is an easy solution to this. I'm using User.Identity.Name to get the windows username for anyone accessing a web app I developed (intranet site). However, when another user accesses the same site the username of the previous user still appears on the page....what am I doing wrong. 


sum ..... where user = user.identity.name , how ? clearly , easy, for people like .

  

i want to use dataset , or any thing ... to display Sum *  where user= user.identity.name(not use gridvew, or formview) because i have more then 100 columns  . i m newbie. realy , 1 month, it not solve,  sometime , i want to give up


problem with User.Identity.Name

  

 I am getting an error on User that says "The name User does not exist in the current context".

I have downloaded the program Tailspin from www.asp.net

I am following the tutorial and recreating it from scratch. The problem exists in a class that was put into a folder called Classes. Here is the code. (Note in the downloaded program when I hover over the word user the tooltip says - System.Security.Principle.IPrincipal Page.User

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using uboPrducts.Data_Access;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace uboPrducts.Classes
{
    public struct ShoppingCartUpdates
    {
        public int ProductId;
        public int PurchaseQantity;
        public bool RemoveItem;
    }

    public partial class MyShoppingCart
    {
        public const string CartId = "TailSpinSpyWorks_CartID";

        //------------------------------------------------------------------------------------------------------------------------------------------+
        public String GetShoppingCartId()
        {
            
            if ( System.Web.HttpContext.Current.Session[CartId] == null)
            {
                System.Web.HttpContext.Current.Session[CartId] = S

Forefront Identity Manager errors when starting the User Profile Synchronization Service Application

  
I have seen several people who are having trouble getting the User Profile Synchronization Service to start.  None of those threads have the set of errors that I am seeing.  I have all the prerequisites installed and I am using the farm administrator account which has admin rights both on the SP server and the SQL box.  This is a split back-to-back extranet topology and there is a one way trust between the extranet domain and the internal domain.  The administrator account is an internal domain account.  I receive the following two Forefront errors every five seconds in the event log after starting the User Profile Synchronization Service Application:

.Net SqlClient Data Provider: System.Data.SqlClient.SqlException: HostId is not registered
   at Microsoft.ResourceManagement.Data.Exception.DataAccessExceptionManager.ThrowException(SqlException innerException)
   at Microsoft.ResourceManagement.Data.DataAccess.RetrieveWorkflowDataForHostActivator(Int16 hostId, Int16 pingIntervalSecs, Int32 activeHostedWorkflowDefinitionsSequenceNumber, Int16 workflowControlMessagesMaxPerMinute, Int16 requestRecoveryMaxPerMinute, Int16 requestCleanupMaxPerMinute, Boolean runRequestRecoveryScan, Boolean& doPolicyApplicationDispatch, ReadOnlyCollection`1& activ

HttpContext.Current.User.Identity.Name

  

Hi ALL,

I am using Principal class to get the user information

 HttpContext.Current.User.Identity.Name thro this i am getting doamin name and NT ID

So how can i extract User name and email from NT ID

 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend