Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Simple OO issue

Reply
Thread Tools

Simple OO issue

 
 
Paul W
Guest
Posts: n/a
 
      11-21-2004
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.


 
Reply With Quote
 
 
 
 
Chris R. Timmons
Guest
Posts: n/a
 
      11-21-2004
"Paul W" <(E-Mail Removed)> wrote in
news:OiEHYA#(E-Mail Removed):

> 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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple VB.Net / webservice requirement (but not simple for me....) Dave E ASP .Net 7 01-11-2006 02:07 PM
Simple Question - Simple Answer? Daniel Frey XML 4 01-12-2005 04:25 PM
Re: Simple Simple question!!! Kevin Spencer ASP .Net 0 06-25-2004 05:25 PM
Re: Simple Simple question!!! ashelley@inlandkwpp.com ASP .Net 0 06-25-2004 04:18 PM
A few simple problems in a simple program. jmac@berkeley.edu C Programming 7 07-23-2003 09:51 PM



Advertisments