"Paul W" <qq*@qqq.com> wrote in
news:Oi**************@tk2msftngp13.phx.gbl:
I want to refer to server.machinename in a module (not
code-behind a page).
If I try:
dim uu as string
uu = System.Web.HttpServerUtility.MachineName
I get a compile error "Reference to a non-shared member requires
an object reference". Huh?
(If you can also point me to where I can read-up on what I'm
missing, I'd appreciate it).
Paul,
Try
dim uu as string
uu = HttpContext.Current.Server.MachineName
Asp.Net automatically creates instances of HttpContext, HttpRequest,
HttpResponse and HttpServerUtility. All of these instances are
available to the current context, as shown above (see the help entry
for System.Web.HttpContext). Also, the HttpRequest and HttpResponse
instances are also available thru the current page (see the help
entry for System.Web.UI.Page).
Read this for more info:
http://msdn.microsoft.com/library/de...l=/library/en-
us/cpguide/html/cpconcreatingaspwebapplications.asp
or
http://tinyurl.com/6kgsw
--
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/