473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Simple OO issue

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.
Nov 18 '05 #1
1 1070
"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/
Nov 18 '05 #2

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

Similar topics

2
by: Dave Mateer | last post by:
Hi Why does the following code allow me to keep the same session when in the same sub domain (ie admin.localhost), yet not when I goto another related domain eg main.localhost? I would like...
10
by: george young | last post by:
For each run of my app, I have a known set of (<100) wafer names. Names are sometimes simply integers, sometimes a short string, and sometimes a short string followed by an integer, e.g.: 5, 6,...
4
by: Gauthier | last post by:
Hi, I've a simple issue with the use of extension objects. I'm trying to call a text formating method from an object that I add to my arguments collection, this method take an input string and...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
1
by: Maik Thiele | last post by:
Hey, I have following simple ftpService class with a method download. When I run the class not as a web service it works fine. But when I run the class as a web service the FtpGetFile() method...
4
by: darrel | last post by:
We're a two person dev team with a handful of 'testers' that help us out. I'm looking for a simple issue tracker. I don't really want a full blown help desk/bug tracking system, but rather a...
4
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state...
2
by: Dragan | last post by:
Hi, We're working in VS 2005, Team edition, if it makes any difference at all (should be up-to-date and all that, but could not guarantee it is 100%). We've implemented a simple generic wrapper...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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,...

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.