Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Discern among servers with the MachineName property

Total Hit ( 2802)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


As in classic ASP, you can use the Server object from inside any ASP.NET application. This property returns a reference to an HttpServerUtility class.

The HttpServerUtility class exposes only two properties: ScriptTimeout (the timeout in seconds for a request) and the new MachineName property, which returns the name of the server computer. You can use the latter property to understand whether the ASP.NET application is running on the development box or on the production server; this information might be useful to adopt slightly different parameters (for example, the connection string to the database).

Click here to copy the following block
' This code assumes that you have two computers: DEV (for testing)
' and PRODUCT for the real production site.

If Server.MachineName = "DEV" Then
  ' running on the DEV test computer
Else
  ' running on the production machine
End If


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.