473,774 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't access System.Web.Http ServerUtility in class

Joe
Hello All;

I can't access System.Web.Http ServerUtility from within a Class. I want to
have access to MapPath.

What I get are three options. They are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

What gives? What did I miss?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
Nov 19 '05 #1
17 3620
Try :

HttpContext.Cur rent.Server.Map Path("filename. aspx")


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
Hello All;

I can't access System.Web.Http ServerUtility from within a Class. I want to
have access to MapPath.

What I get are three options. They are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

What gives? What did I miss?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #2
You need an instance of that class to access the members. Nothing is
static.
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
Hello All;

I can't access System.Web.Http ServerUtility from within a Class. I want
to
have access to MapPath.

What I get are three options. They are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

What gives? What did I miss?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #3
I guess in light of Juan's explaination, never mind.

"Peter Rilling" <pe***@nospam.r illing.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
You need an instance of that class to access the members. Nothing is
static.
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
Hello All;

I can't access System.Web.Http ServerUtility from within a Class. I want
to
have access to MapPath.

What I get are three options. They are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

What gives? What did I miss?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #4
Joe
No. They're not there. The only options are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

Do you know why?

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Juan T. Llibre" wrote:
Try :

HttpContext.Cur rent.Server.Map Path("filename. aspx")


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
Hello All;

I can't access System.Web.Http ServerUtility from within a Class. I want to
have access to MapPath.

What I get are three options. They are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

What gives? What did I miss?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #5
What do you mean "They're not there", Joe ?

All you have to do, within any class file, is write

HttpContext.

and the available options *will* come up in Intellisense.

First, you choose HttpContext.Cur rent and when you add another dot

HttpContext.Cur rent.

You then select Server and get HttpContext.Cur rent.Server
and then you add another dot :

HttpContext.Cur rent.Server. and you select MapPath
which gives you HttpContext.Cur rent.Server.Map Path

Then, all you need to do is add ("YourFileName. aspx")

If you don't do that, you won't see the correct options.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
No. They're not there. The only options are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

Do you know why?
--
Joe "Juan T. Llibre" wrote:
Try :

HttpContext.Cur rent.Server.Map Path("filename. aspx")


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
> Hello All;
>
> I can't access System.Web.Http ServerUtility from within a Class. I want to
> have access to MapPath.
>
> What I get are three options. They are:
>
> AspNetHostingPe rmission
> AspNetHostingPe rmissionAttribu tes
> AspNetHostingPe rmissionLevel
>
> What gives? What did I miss?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #6
Joe
Peter,

If I type Dim s as System.Web. what appears in the Intellisense are the
following options:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

I can't even get to the HttpCoontext or HttpServerUtili ties class.

Any ideas?
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Peter Rilling" wrote:
I guess in light of Juan's explaination, never mind.

"Peter Rilling" <pe***@nospam.r illing.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
You need an instance of that class to access the members. Nothing is
static.
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
Hello All;

I can't access System.Web.Http ServerUtility from within a Class. I want
to
have access to MapPath.

What I get are three options. They are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

What gives? What did I miss?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation



Nov 19 '05 #7
Joe
Hi Juan,

I mean that they're not there.

If I type "System" fiollowed by a period, the intellisense shows the options
within System. I select Web. After Web, I type a period and the
intellisense shows the following three options:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Juan T. Llibre" wrote:
What do you mean "They're not there", Joe ?

All you have to do, within any class file, is write

HttpContext.

and the available options *will* come up in Intellisense.

First, you choose HttpContext.Cur rent and when you add another dot

HttpContext.Cur rent.

You then select Server and get HttpContext.Cur rent.Server
and then you add another dot :

HttpContext.Cur rent.Server. and you select MapPath
which gives you HttpContext.Cur rent.Server.Map Path

Then, all you need to do is add ("YourFileName. aspx")

If you don't do that, you won't see the correct options.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
No. They're not there. The only options are:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

Do you know why?
--
Joe

"Juan T. Llibre" wrote:
Try :

HttpContext.Cur rent.Server.Map Path("filename. aspx")


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:6A******** *************** ***********@mic rosoft.com...
> Hello All;
>
> I can't access System.Web.Http ServerUtility from within a Class. I want to
> have access to MapPath.
>
> What I get are three options. They are:
>
> AspNetHostingPe rmission
> AspNetHostingPe rmissionAttribu tes
> AspNetHostingPe rmissionLevel
>
> What gives? What did I miss?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #8
You don't need to type System.

All you nee to type is HttpContext.

Notice the period after HttpContext.
You *must* include the period for Intellisense to kick in.

Then, select Current, and so on, as listed in my previous post.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:40******** *************** ***********@mic rosoft.com...
Hi Juan,

I mean that they're not there.

If I type "System" fiollowed by a period, the intellisense shows the options
within System. I select Web. After Web, I type a period and the
intellisense shows the following three options:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Juan T. Llibre" wrote:
What do you mean "They're not there", Joe ?

All you have to do, within any class file, is write

HttpContext.

and the available options *will* come up in Intellisense.

First, you choose HttpContext.Cur rent and when you add another dot

HttpContext.Cur rent.

You then select Server and get HttpContext.Cur rent.Server
and then you add another dot :

HttpContext.Cur rent.Server. and you select MapPath
which gives you HttpContext.Cur rent.Server.Map Path

Then, all you need to do is add ("YourFileName. aspx")

If you don't do that, you won't see the correct options.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
> No. They're not there. The only options are:
>
> AspNetHostingPe rmission
> AspNetHostingPe rmissionAttribu tes
> AspNetHostingPe rmissionLevel
>
> Do you know why?
> --
> Joe

> "Juan T. Llibre" wrote:
>
>> Try :
>>
>> HttpContext.Cur rent.Server.Map Path("filename. aspx")
>>
>>
>>
>>
>> Juan T. Llibre, ASP.NET MVP
>> ASP.NET FAQ : http://asp.net.do/faq/
>> Foros de ASP.NET en Español : http://asp.net.do/foros/
>> =============== =============== ========
>> "Joe" <jo******@donot spam.yahoo.com> wrote in message
>> news:6A******** *************** ***********@mic rosoft.com...
>> > Hello All;
>> >
>> > I can't access System.Web.Http ServerUtility from within a Class. I want to
>> > have access to MapPath.
>> >
>> > What I get are three options. They are:
>> >
>> > AspNetHostingPe rmission
>> > AspNetHostingPe rmissionAttribu tes
>> > AspNetHostingPe rmissionLevel
>> >
>> > What gives? What did I miss?
>> >
>> > TIA,
>> > --
>> > Joe
>> >
>> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>>
>>
>>


Nov 19 '05 #9
Joe
Juan,

I understand how intellisense works. We don't need to go over that.

I tried typing HttpContext with the period. Nothing happens.

Remember that I am not doing this is in a webpage code-behind. I'm doing it
in a class (myClass.vb, not myPage.aspx).

This may have everything to do with where I am trying to do this.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Juan T. Llibre" wrote:
You don't need to type System.

All you nee to type is HttpContext.

Notice the period after HttpContext.
You *must* include the period for Intellisense to kick in.

Then, select Current, and so on, as listed in my previous post.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:40******** *************** ***********@mic rosoft.com...
Hi Juan,

I mean that they're not there.

If I type "System" fiollowed by a period, the intellisense shows the options
within System. I select Web. After Web, I type a period and the
intellisense shows the following three options:

AspNetHostingPe rmission
AspNetHostingPe rmissionAttribu tes
AspNetHostingPe rmissionLevel

--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


"Juan T. Llibre" wrote:
What do you mean "They're not there", Joe ?

All you have to do, within any class file, is write

HttpContext.

and the available options *will* come up in Intellisense.

First, you choose HttpContext.Cur rent and when you add another dot

HttpContext.Cur rent.

You then select Server and get HttpContext.Cur rent.Server
and then you add another dot :

HttpContext.Cur rent.Server. and you select MapPath
which gives you HttpContext.Cur rent.Server.Map Path

Then, all you need to do is add ("YourFileName. aspx")

If you don't do that, you won't see the correct options.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Joe" <jo******@donot spam.yahoo.com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
> No. They're not there. The only options are:
>
> AspNetHostingPe rmission
> AspNetHostingPe rmissionAttribu tes
> AspNetHostingPe rmissionLevel
>
> Do you know why?
> --
> Joe

> "Juan T. Llibre" wrote:
>
>> Try :
>>
>> HttpContext.Cur rent.Server.Map Path("filename. aspx")
>>
>>
>>
>>
>> Juan T. Llibre, ASP.NET MVP
>> ASP.NET FAQ : http://asp.net.do/faq/
>> Foros de ASP.NET en Español : http://asp.net.do/foros/
>> =============== =============== ========
>> "Joe" <jo******@donot spam.yahoo.com> wrote in message
>> news:6A******** *************** ***********@mic rosoft.com...
>> > Hello All;
>> >
>> > I can't access System.Web.Http ServerUtility from within a Class. I want to
>> > have access to MapPath.
>> >
>> > What I get are three options. They are:
>> >
>> > AspNetHostingPe rmission
>> > AspNetHostingPe rmissionAttribu tes
>> > AspNetHostingPe rmissionLevel
>> >
>> > What gives? What did I miss?
>> >
>> > TIA,
>> > --
>> > Joe
>> >
>> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>>
>>
>>


Nov 19 '05 #10

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

Similar topics

1
1867
by: uv2003 | last post by:
Greetings, I've read through some other posts and looked at this class through reflector. All of its contructors are internal, so it cannot be instantiated outside of ASP.NET. This seems unfortunate to me. I'd like to be able to UrlEncode some text completely independent of a web server. Is the only solution to write my own class that does the same thing? Thanks
3
9835
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has user interface. how should have get window handle from managed windows? Thanks in advance. Sushil
29
15551
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ---Start of test.aspx---- <%@ Page language="C#" AutoEventWireup="false" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD>
10
1930
by: bradtm | last post by:
So I have this hierarchy: + Solution | |--- + Class Library Project | | | |--- LogError.vb | |--- + ASP .NET Web Application |
4
1095
by: Plop Plop via DotNetMonster.com | last post by:
Hello, i'm a newbie at asp.net, and i'm developping a site at the moment, and want to add a sort off logging system. I would like to create a file on the server side when a error occured. Now how can i do that? On my pc i have c:\inetput\wwwroot\sitename
3
1901
by: Rachel | last post by:
Hi, I am using the data access application block successfully in our development environment, however when I deploy to our testing server as Private Assemblies I keep getting the following Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
1
1727
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class (derived from System.Web.UI.Page). So, for instance, my home page's inheritance chain looks like this: HomePage Inherits WebPageBase
4
3580
by: mark4asp | last post by:
What is the best way to locate the namespace I need to put in a using statement? For example suppose I wanted to discover which namespace "Server" was in the context of: Exception ex = Server.GetLastError(); - code that is normally placed in Global Application_Error() but which I want to put in a separate class.
6
9161
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %> On the Master Page I have a public property exposed: Public Property ErrorMessage() As String Get Return txtError.InnerText End Get
0
9621
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10040
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.