getting computer name from asp-dot-net

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.
 
M

Mattias Sjögren

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
 
M

Mattias Sjögren

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
 
G

Gabe Garza

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.
 
Z

z. f.

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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top