473,748 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Possibly dumb question about Environment.Mac hineName

I've just taken over maintaining a system from a colleague who has
left. I find the following line in her code:

Dim params(2) As SqlClient.SqlPa rameter

params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
params(2) = New SqlClient.SqlPa rameter("@Machi neName",
Environment.Mac hineName())

When I run the code in the debugger, I find that the value of
Environment.Mac hineName is the same as the name of my PC. But I'm
running this on my localhost IIS.

So, my question is: if I run this in my browser but with the
application on a different web server, what will the value of
Environment.Mac hineName?

Do I make myself clear? Am I as dumb as a bag of spanners?

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk
Nov 18 '05 #1
10 2318
Edward,

It's a server-side code. It will produce the server's name.

Eliyahu

"Edward" <te********@hot mail.com> wrote in message
news:25******** *************** **@posting.goog le.com...
I've just taken over maintaining a system from a colleague who has
left. I find the following line in her code:

Dim params(2) As SqlClient.SqlPa rameter

params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
params(2) = New SqlClient.SqlPa rameter("@Machi neName",
Environment.Mac hineName())

When I run the code in the debugger, I find that the value of
Environment.Mac hineName is the same as the name of my PC. But I'm
running this on my localhost IIS.

So, my question is: if I run this in my browser but with the
application on a different web server, what will the value of
Environment.Mac hineName?

Do I make myself clear? Am I as dumb as a bag of spanners?

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk

Nov 18 '05 #2
Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in. You could even use it in
Windows Forms. So no matter what it will give you the name of the PC.
Check this link in MSDN for the proper definition
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemenvi ronmentclassmac hinenametopic.a sp

Alan Ferrandiz
MCT;MCSD,MCDBA
MSF Practitioner

"Edward" <te********@hot mail.com> escribió en el mensaje
news:25******** *************** **@posting.goog le.com...
I've just taken over maintaining a system from a colleague who has
left. I find the following line in her code:

Dim params(2) As SqlClient.SqlPa rameter

params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
params(2) = New SqlClient.SqlPa rameter("@Machi neName",
Environment.Mac hineName())

When I run the code in the debugger, I find that the value of
Environment.Mac hineName is the same as the name of my PC. But I'm
running this on my localhost IIS.

So, my question is: if I run this in my browser but with the
application on a different web server, what will the value of
Environment.Mac hineName?

Do I make myself clear? Am I as dumb as a bag of spanners?

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk

Nov 18 '05 #3
Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in. You could even use it in
Windows Forms. So no matter what it will give you the name of the PC.
Check this link in MSDN for the proper definition
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemenvi ronmentclassmac hinenametopic.a sp

Alan Ferrandiz
MCT;MCSD,MCDBA
MSF Practitioner

"Edward" <te********@hot mail.com> escribió en el mensaje
news:25******** *************** **@posting.goog le.com...
I've just taken over maintaining a system from a colleague who has
left. I find the following line in her code:

Dim params(2) As SqlClient.SqlPa rameter

params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
params(2) = New SqlClient.SqlPa rameter("@Machi neName",
Environment.Mac hineName())

When I run the code in the debugger, I find that the value of
Environment.Mac hineName is the same as the name of my PC. But I'm
running this on my localhost IIS.

So, my question is: if I run this in my browser but with the
application on a different web server, what will the value of
Environment.Mac hineName?

Do I make myself clear? Am I as dumb as a bag of spanners?

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk

Nov 18 '05 #4
> Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in.
I have to disagree here. Environment.Mac hineName gets the name of the
machine in whose Environment the application is running. In a web
application, this would be the name of the server on which the ASP.Net
process is running. "The computer you are in" is a non-sequitor. It is not
possible for a person to be "in" a computer. If you meant by that, the
computer that the user is using, in a web application running server-side
code, that statement would be false.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Alan Ferrandiz Langley" <af********@onl ine.labroe.com> wrote in message
news:e7******** ******@TK2MSFTN GP11.phx.gbl... Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in. You could even use it in Windows Forms. So no matter what it will give you the name of the PC.
Check this link in MSDN for the proper definition
http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemenvi ronmentclassmac hinenametopic.a sp

Alan Ferrandiz
MCT;MCSD,MCDBA
MSF Practitioner

"Edward" <te********@hot mail.com> escribió en el mensaje
news:25******** *************** **@posting.goog le.com...
I've just taken over maintaining a system from a colleague who has
left. I find the following line in her code:

Dim params(2) As SqlClient.SqlPa rameter

params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
params(2) = New SqlClient.SqlPa rameter("@Machi neName",
Environment.Mac hineName())

When I run the code in the debugger, I find that the value of
Environment.Mac hineName is the same as the name of my PC. But I'm
running this on my localhost IIS.

So, my question is: if I run this in my browser but with the
application on a different web server, what will the value of
Environment.Mac hineName?

Do I make myself clear? Am I as dumb as a bag of spanners?

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk


Nov 18 '05 #5
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:<#B******* ******@TK2MSFTN GP11.phx.gbl>.. .
Edward,

It's a server-side code. It will produce the server's name.

Eliyahu


Thanks. I thought it was.

Edward
Nov 18 '05 #6
> Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in.
I have to disagree here. Environment.Mac hineName gets the name of the
machine in whose Environment the application is running. In a web
application, this would be the name of the server on which the ASP.Net
process is running. "The computer you are in" is a non-sequitor. It is not
possible for a person to be "in" a computer. If you meant by that, the
computer that the user is using, in a web application running server-side
code, that statement would be false.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Alan Ferrandiz Langley" <af********@onl ine.labroe.com> wrote in message
news:e7******** ******@TK2MSFTN GP11.phx.gbl... Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in. You could even use it in Windows Forms. So no matter what it will give you the name of the PC.
Check this link in MSDN for the proper definition
http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemenvi ronmentclassmac hinenametopic.a sp

Alan Ferrandiz
MCT;MCSD,MCDBA
MSF Practitioner

"Edward" <te********@hot mail.com> escribió en el mensaje
news:25******** *************** **@posting.goog le.com...
I've just taken over maintaining a system from a colleague who has
left. I find the following line in her code:

Dim params(2) As SqlClient.SqlPa rameter

params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
params(2) = New SqlClient.SqlPa rameter("@Machi neName",
Environment.Mac hineName())

When I run the code in the debugger, I find that the value of
Environment.Mac hineName is the same as the name of my PC. But I'm
running this on my localhost IIS.

So, my question is: if I run this in my browser but with the
application on a different web server, what will the value of
Environment.Mac hineName?

Do I make myself clear? Am I as dumb as a bag of spanners?

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk


Nov 18 '05 #7
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:<#B******* ******@TK2MSFTN GP11.phx.gbl>.. .
Edward,

It's a server-side code. It will produce the server's name.

Eliyahu


Thanks. I thought it was.

Edward
Nov 18 '05 #8
Yes you are right Kevin, Environment.Mac hineName is going to get the name of
the computer your application is running on. Well in this case Edward is
developing his application so in this situation he will get the name of the
computer he is developing the application in. If one wants to get
information of the client computer, one would have to use the Request
object. Anyway Spanish is my mother tongue, I'm improving my English
everyday.

Alan Ferrandiz L.
MCT; MCSD; MCDBA
MSF Practitioner
Lima - Peru

"Kevin Spencer" <ks******@takem pis.com> escribió en el mensaje
news:e3******** ******@TK2MSFTN GP10.phx.gbl...
Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in.
I have to disagree here. Environment.Mac hineName gets the name of the
machine in whose Environment the application is running. In a web
application, this would be the name of the server on which the ASP.Net
process is running. "The computer you are in" is a non-sequitor. It is not
possible for a person to be "in" a computer. If you meant by that, the
computer that the user is using, in a web application running server-side
code, that statement would be false.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Alan Ferrandiz Langley" <af********@onl ine.labroe.com> wrote in message
news:e7******** ******@TK2MSFTN GP11.phx.gbl...
Environment.Mac hineName does not get the name of the web server you are
runnnig on but the name of the computer you are in. You could even use it in
Windows Forms. So no matter what it will give you the name of the PC.
Check this link in MSDN for the proper definition

http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemenvi ronmentclassmac hinenametopic.a sp

Alan Ferrandiz
MCT;MCSD,MCDBA
MSF Practitioner

"Edward" <te********@hot mail.com> escribió en el mensaje
news:25******** *************** **@posting.goog le.com...
I've just taken over maintaining a system from a colleague who has
left. I find the following line in her code:

Dim params(2) As SqlClient.SqlPa rameter

params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
params(2) = New SqlClient.SqlPa rameter("@Machi neName",
Environment.Mac hineName())

When I run the code in the debugger, I find that the value of
Environment.Mac hineName is the same as the name of my PC. But I'm
running this on my localhost IIS.

So, my question is: if I run this in my browser but with the
application on a different web server, what will the value of
Environment.Mac hineName?

Do I make myself clear? Am I as dumb as a bag of spanners?

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk



Nov 18 '05 #9
Mucho gusto, Alan,

Unfortunately, the Request object will only have the IP address of the
client machine. This is certainly available to the server.

Su Ingles es mucho mejor que mi espanol!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Alan Ferrandiz Langley" <af********@onl ine.labroe.com> wrote in message
news:Oz******** ******@TK2MSFTN GP11.phx.gbl...
Yes you are right Kevin, Environment.Mac hineName is going to get the name of the computer your application is running on. Well in this case Edward is
developing his application so in this situation he will get the name of the computer he is developing the application in. If one wants to get
information of the client computer, one would have to use the Request
object. Anyway Spanish is my mother tongue, I'm improving my English
everyday.

Alan Ferrandiz L.
MCT; MCSD; MCDBA
MSF Practitioner
Lima - Peru

"Kevin Spencer" <ks******@takem pis.com> escribió en el mensaje
news:e3******** ******@TK2MSFTN GP10.phx.gbl...
Environment.Mac hineName does not get the name of the web server you are runnnig on but the name of the computer you are in.


I have to disagree here. Environment.Mac hineName gets the name of the
machine in whose Environment the application is running. In a web
application, this would be the name of the server on which the ASP.Net
process is running. "The computer you are in" is a non-sequitor. It is not
possible for a person to be "in" a computer. If you meant by that, the
computer that the user is using, in a web application running server-side code, that statement would be false.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Alan Ferrandiz Langley" <af********@onl ine.labroe.com> wrote in message
news:e7******** ******@TK2MSFTN GP11.phx.gbl...
Environment.Mac hineName does not get the name of the web server you are runnnig on but the name of the computer you are in. You could even use

it
in
Windows Forms. So no matter what it will give you the name of the PC.
Check this link in MSDN for the proper definition

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemenvi ronmentclassmac hinenametopic.a sp

Alan Ferrandiz
MCT;MCSD,MCDBA
MSF Practitioner

"Edward" <te********@hot mail.com> escribió en el mensaje
news:25******** *************** **@posting.goog le.com...
> I've just taken over maintaining a system from a colleague who has
> left. I find the following line in her code:
>
> Dim params(2) As SqlClient.SqlPa rameter
>
> params(0) = New SqlClient.SqlPa rameter("@UserN ame", pvstrUsername)
> params(1) = New SqlClient.SqlPa rameter("@Passw ord", pvstrPassword)
> params(2) = New SqlClient.SqlPa rameter("@Machi neName",
> Environment.Mac hineName())
>
> When I run the code in the debugger, I find that the value of
> Environment.Mac hineName is the same as the name of my PC. But I'm
> running this on my localhost IIS.
>
> So, my question is: if I run this in my browser but with the
> application on a different web server, what will the value of
> Environment.Mac hineName?
>
> Do I make myself clear? Am I as dumb as a bag of spanners?
>
> Edward
> --
> The reading group's reading group:
> http://www.bookgroup.org.uk



Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
378
by: duncsss | last post by:
Hi, I'm using the following code to get the Machine name in an app System.Environment.MachineName On most computers this works fine but on one of our testers computers (machine is a windows 2000 desktop pc), it's throwing the following exception. Request for the permission of type System.Security.Permissions.EnvironmentPermission, mscorlib, Version = 1.0.50000.0, Culture = neutral, publicKeyToken = blahblahblah failed. I have no idea...
6
1796
by: Flare | last post by:
Hi i just read: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/exceptdotnet.asp Wich is interesting reading by the way. But. I have'nt used exception very much to anything else than ordinary FileExeptions etc. Now i want to create my own exception hierarchy. I want to do this so that i can log the exceltion information to a file or a database. Doesent mather right now.
0
1060
by: Paul Duncan | last post by:
Hi, I'm using the following code to get the Machine name in an app System.Environment.MachineName On most computers this works fine but on one of our testers computers (machine is a windows 2000 desktop pc, not a networking share either), it's throwing the following exception. Request for the permission of type System.Security.Permissions.EnvironmentPermission, mscorlib, Version =
2
2815
by: Ely | last post by:
When I call the Environment.Machinename to try to get the local machines name, I get a "Object reference not set to an instance of an object" error. This same code works fine on my local machine, it just started having problems when i rolled it out to a production machine. Thanks
2
4932
by: tmoffett | last post by:
I am very new to the language so please pardon my ignorance. I am writing a small console application to gather hardware inventory information. When I run the application locally all works well. It gathers the needed information and writes that info to a remote SQL server. If I put the file in the scripts folder on our AD domain controller (so that I can use it with login scripts) it fails to run. It also fails when I run it from...
1
1315
by: Terrance | last post by:
Hello, I was wondering if someone can help me understand something. Below is some code that I got from the MS website that is suppose to authenticate for the username and password on the local machine. I tested this code in VB.net 2003 in a WINDOW FORM class and it seems to work fine. However, when I test it in VB.net 2005 Express Edition it works for the login portion but it doesn't display the error message if the user name and password...
7
1120
by: Joel Hedlund | last post by:
Hi! There's one thing about dictionaries and __hash__() methods that puzzle me. I have a class with several data members, one of which is 'name' (a str). I would like to store several of these objects in a dict for quick access ({name:object} style). Now, I was thinking that given a list of objects I might do something like d = {} for o in objects:
3
1943
by: Depechie | last post by:
Hey guys, small question. Can I find out if the current logged on use is a local user or a domain user ? And please don't use any solution that uses String parsing... What I need is to get the display name of the current user and the only way I'm able to do this is using a DLL wrapper :
3
1551
by: J | last post by:
The following code finds the existing file when run in the development environment, but not when deployed (in IIS on the same box). Why? String myFile = @"J:\My_jpgs\The Den\jvc90-03.JPG"; FileInfo f = new FileInfo(myFile); if (!f.Exists) { txtResults.Text += "Can't find " + f.FullName + "\n"; } else
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8252
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.