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

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Deploying asp.net application in IIS6.0 with Forms authentication mode

Posted By: dotnetbubbles     Posted Date: November 21, 2011    Points:5   Category :ASP.Net

I am getting user name by using the following code:

txtName.Text = Environment.UserName;

I have deployed the code in IIS and while running the application then i am getting
user name as "NETWORK SERVICE" in the textbox instead of logged user name.

And I am using the FORMS authentication mode. (this is mandatory)

Thanks in advance.

Author: Akhil Raj       [Moderator]      
Posted Date: November 22, 2011     Points: 20   

sorry friend. I dindt get you. Why you call Environment.UserName? If you need windows logged user name you can use the following code

string strName = HttpContext.Current.User.Identity.Name.ToString();

Check this url : http://www.codeproject.com/KB/aspnet/How_to_NT_User_Name.aspx

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

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