ASP.NET - How can i get the LogedIn in user Name of Client machine

Asked By jaikumar kumar
10-Feb-12 12:32 AM

Requiremets are

1.clinet will not provide useid and password n application is not windows authenticated..

(when the users visits the page i need to get In which user Id he/she logedIn)

How can i get the Loged In userName...?Pls let me kw..

  Somesh Yadav replied to jaikumar kumar
10-Feb-12 12:56 AM

Hi, 

User.Identity.Name will return Domain\Username. Please make sure Anonymous Authentication is not enabled, otherwise it returns empty string.

Try this  one,

Page.User.Identity.Name   for  UserName

System.Net.Dns.GetHostName()    for  domain name..

 

Hope this  helps  you.....

  dipa ahuja replied to jaikumar kumar
10-Feb-12 06:10 AM
void getClientInfo()
{
  string RemoteIp = Request.UserHostAddress.ToString();
  string DNSName = Request.UserHostName;
  string user = HttpContext.Current.Request.UserHostAddress;
 
  Response.Write("</br>Remote Ip:" + RemoteIp);
  Response.Write("</br>DNS Name :" + RemoteIp);
  Response.Write("</br>" + Environment.MachineName.ToString());
  Response.Write("</br>  User:" + user.ToString());
 
  Response.Write("</br>" + Environment.UserName.ToString());
  Response.Write("</br>" + System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString());
}
 
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are
in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging enable the trace to true in the line in the html format of the page. %@ Page Language = ”vb” trace = ”true”AutoEventWireup = ”false” Codebehind = ”WebForm1.aspx.vb” Inherits = ”WebApplication2.WebForm1?&gt; 2
faqs on masterpages Hi all, can anybody tell me the FAQs on Masterpages in asp.net. Thanks alot var Hi What are Master Pages in ASP.NET? or What is a Master Page? ASP.NET master pages allow you to create a consistent layout for the pages in your application A single master page defines the look and feel and standard behavior that you want for all of the
Page Directive? What is the purpose of page directive in aspx page? Directive Syntax Directives are instructions used to specify settings (related to how a page should render and processed) used by the page and user control compilers when they process ASP.NET Web Forms page (.aspx) and user control (.ascx) files. These are the essential part of every ASP.NET
Tracing in ASP.NET? hi all, what is tracing? how to achieve tracing in asp.net? different ways of doing tracing? thanks and regards Aman Khan hi. . Tracing in ASP.NET 2.0 Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't