IIS - Displaying IP address and system username

Asked By Stephen on 28-Apr-12 04:42 AM
I want to display IP address and system username while printing how can i do that?
Chintan Vaghela replied to Stephen on 28-Apr-12 04:58 AM

Hello,

 

IP address is:

 

 

Request.ServerVariables("remote_addr")

 

 

domain name:

 

Request.ServerVariables("server_name")

 

 

Hope this helpful!

Thanks

 

 

kalpana aparnathi replied to Stephen on 28-Apr-12 05:49 AM
hi,

step you have to follow for accessing through sys IP:

step 1: Click on Start--> Run-->type in textbox 'Inetmgr', to open IIS .

step 2: click on Websites-->Default Websites --> YourWebApplicationName

         browse through your application virtual directory.

step 3.right click on WebApplication and select PROPERTIES.

       click on 'Directory Security' Tab

step 4.In 'Anonymous Access and Authentication Control' click on EDIT .

step 5.Check the checkbox 'Anonymous Access' and uncheck remaining all (except Allow IIS to control password, Let it be checked)

step 6.Click Ok. again OK.

Step 7.now open control panel-->Windows Firewall

step 8.click on Exceptions Tab.

step 9.Click on Add Port. Enter Name: IIS and Port Number : 80 Click Ok.again Click OK.

step 10.now open IE and enter your system IP : http://192.168.X.X/

        it shoud show IIS default page or "Under Construction page" if any other output check from step1 to step 10 and properties of virtual directory.



Regards,
dipa ahuja replied to Stephen on 28-Apr-12 06:58 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());
}
 
Somesh Yadav replied to Stephen on 28-Apr-12 10:51 AM
check this,
http://www.softspecialist.com/i/show-ip-address