-1

I'm building a web page with visual studio 2010. I want to used pass word recovery control. I need to find out what server Name is, so I can use SMTP setting to send emails to the user who forgets his pass word. I don't know how to get it. Does anybody know. I appreciate it very much.

user2363786
  • 25
  • 1
  • 5

1 Answers1

1

My.Computer.Name should do the trick in VB. @Vache said that My.Computer does not exist in C#.

Or

System.Environment.MachineName, as pointed out by a commentor.

It looks like System.Environment.MachineName may be preferred, as that is a static method. My.Computer.Name seems to be added at the project level; when I just tried it in the Immediate Window within a solution that has numerous projects, the call was ambiguous. I had to fully qualify it by a project's namespace before I could get the value. E.g., MyNamespace.Project1.My.Computer.Name. However, you shouldn't have to qualify it if you call it from within a project instead of a global area like I did.

ps2goat
  • 7,102
  • 1
  • 28
  • 59