getting computer name from asp-dot-net

  • Thread starter Thread starter z. f.
  • Start date Start date
Z

z. f.

i need to get the computer name from an aspx page.
i use System.Windows.Forms.SystemInformation.ComputerName()
and it's working fine,
but in second thought, it might not be recomended to use the
system.windows.forms.dll
inside an asp-dot-net code.
any information here will help.
TIA, z.
 
i need to get the computer name from an aspx page.
i use System.Windows.Forms.SystemInformation.ComputerName()
and it's working fine,
but in second thought, it might not be recomended to use the
system.windows.forms.dll
inside an asp-dot-net code.
any information here will help.


System.Environment.MachineName



Mattias
 
do you have something instead of
System.Windows.Forms.Application.StartupPath

How are you using it? I don't see how the startup path would be
relevant in a web app.



Mattias
 
I'd check your computer name again, I'm pretty sure the computer name is the
server that has your ASPX page on it, not the client computer name.
If it is returning the right name it's probably because you're testing your
code on the same computer that has your ASPX page. That's why you think it's
working.

You can't get a computer name from a client computer from a ASPX page.
The reason is, a computer name how your looking at it is a Windows
"attribute" if you will. If you use
'System.Windows.Forms.SystemInformation.ComputerName()' you're implying that
your running on a NTLM Network.

FreeBSD, Linux, Solaris, etc have computer names when setup in an DNS, but
there not the same as the windows computer name.

System.Security.Principal.WindowsIdentity can get you user information if
you've setup IIS with Windows Authentication (NTLM), then the
WindowsIdentity information will be filled in. If you don't setup Windows
Authentication then WindowsIdentity will be null.

If you want remote client information, the thing to look at is:
HttpRequest.ServerVariables

I wouldn't rely too much on this only because any client can spoof this
information.
 
it is used inside a "general purpose" DLL library that is referenced from
web apps and windows apps as well.
so i there a replacement for Application.StartupPath not from
System.Windows.Forms.Dll ?
 
Back
Top