Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Can't access System.Web.HttpServerUtility in class

 
Thread Tools Search this Thread
Old 10-27-2005, 05:52 PM   #1
Default Can't access System.Web.HttpServerUtility in class


Hello All;

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

What I get are three options. They are:

AspNetHostingPermission
AspNetHostingPermissionAttributes
AspNetHostingPermissionLevel

What gives? What did I miss?

TIA,
--
Joe

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


=?Utf-8?B?Sm9l?=
  Reply With Quote
Old 10-27-2005, 06:13 PM   #2
Juan T. Llibre
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
Try :

HttpContext.Current.Server.MapPath("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" <> wrote in message
news:6AE7DADE-3A6A-470A-8EE9-...
> Hello All;
>
> I can't access System.Web.HttpServerUtility from within a Class. I want to
> have access to MapPath.
>
> What I get are three options. They are:
>
> AspNetHostingPermission
> AspNetHostingPermissionAttributes
> AspNetHostingPermissionLevel
>
> What gives? What did I miss?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation





Juan T. Llibre
  Reply With Quote
Old 10-27-2005, 06:15 PM   #3
Peter Rilling
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
You need an instance of that class to access the members. Nothing is
static.


"Joe" <> wrote in message
news:6AE7DADE-3A6A-470A-8EE9-...
> Hello All;
>
> I can't access System.Web.HttpServerUtility from within a Class. I want
> to
> have access to MapPath.
>
> What I get are three options. They are:
>
> AspNetHostingPermission
> AspNetHostingPermissionAttributes
> AspNetHostingPermissionLevel
>
> What gives? What did I miss?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation





Peter Rilling
  Reply With Quote
Old 10-27-2005, 06:23 PM   #4
Peter Rilling
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
I guess in light of Juan's explaination, never mind.

"Peter Rilling" <> wrote in message
news:%...
> You need an instance of that class to access the members. Nothing is
> static.
>
>
> "Joe" <> wrote in message
> news:6AE7DADE-3A6A-470A-8EE9-...
>> Hello All;
>>
>> I can't access System.Web.HttpServerUtility from within a Class. I want
>> to
>> have access to MapPath.
>>
>> What I get are three options. They are:
>>
>> AspNetHostingPermission
>> AspNetHostingPermissionAttributes
>> AspNetHostingPermissionLevel
>>
>> What gives? What did I miss?
>>
>> TIA,
>> --
>> Joe
>>
>> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

>
>





Peter Rilling
  Reply With Quote
Old 10-27-2005, 06:25 PM   #5
=?Utf-8?B?Sm9l?=
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
No. They're not there. The only options are:

AspNetHostingPermission
AspNetHostingPermissionAttributes
AspNetHostingPermissionLevel

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.Current.Server.MapPath("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" <> wrote in message
> news:6AE7DADE-3A6A-470A-8EE9-...
> > Hello All;
> >
> > I can't access System.Web.HttpServerUtility from within a Class. I want to
> > have access to MapPath.
> >
> > What I get are three options. They are:
> >
> > AspNetHostingPermission
> > AspNetHostingPermissionAttributes
> > AspNetHostingPermissionLevel
> >
> > What gives? What did I miss?
> >
> > TIA,
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

>
>
>



=?Utf-8?B?Sm9l?=
  Reply With Quote
Old 10-27-2005, 06:42 PM   #6
Juan T. Llibre
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
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.Current and when you add another dot

HttpContext.Current.

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

HttpContext.Current.Server. and you select MapPath
which gives you HttpContext.Current.Server.MapPath

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" <> wrote in message
news:B02B16E2-0595-4DB7-AF8B-...
> No. They're not there. The only options are:
>
> AspNetHostingPermission
> AspNetHostingPermissionAttributes
> AspNetHostingPermissionLevel
>
> Do you know why?
> --
> Joe


> "Juan T. Llibre" wrote:
>
>> Try :
>>
>> HttpContext.Current.Server.MapPath("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" <> wrote in message
>> news:6AE7DADE-3A6A-470A-8EE9-...
>> > Hello All;
>> >
>> > I can't access System.Web.HttpServerUtility from within a Class. I want to
>> > have access to MapPath.
>> >
>> > What I get are three options. They are:
>> >
>> > AspNetHostingPermission
>> > AspNetHostingPermissionAttributes
>> > AspNetHostingPermissionLevel
>> >
>> > What gives? What did I miss?
>> >
>> > TIA,
>> > --
>> > Joe
>> >
>> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

>>
>>
>>





Juan T. Llibre
  Reply With Quote
Old 10-27-2005, 06:49 PM   #7
=?Utf-8?B?Sm9l?=
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
Peter,

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

AspNetHostingPermission
AspNetHostingPermissionAttributes
AspNetHostingPermissionLevel

I can't even get to the HttpCoontext or HttpServerUtilities 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" <> wrote in message
> news:%...
> > You need an instance of that class to access the members. Nothing is
> > static.
> >
> >
> > "Joe" <> wrote in message
> > news:6AE7DADE-3A6A-470A-8EE9-...
> >> Hello All;
> >>
> >> I can't access System.Web.HttpServerUtility from within a Class. I want
> >> to
> >> have access to MapPath.
> >>
> >> What I get are three options. They are:
> >>
> >> AspNetHostingPermission
> >> AspNetHostingPermissionAttributes
> >> AspNetHostingPermissionLevel
> >>
> >> What gives? What did I miss?
> >>
> >> TIA,
> >> --
> >> Joe
> >>
> >> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

> >
> >

>
>
>



=?Utf-8?B?Sm9l?=
  Reply With Quote
Old 10-27-2005, 06:58 PM   #8
=?Utf-8?B?Sm9l?=
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
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:

AspNetHostingPermission
AspNetHostingPermissionAttributes
AspNetHostingPermissionLevel

--
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.Current and when you add another dot
>
> HttpContext.Current.
>
> You then select Server and get HttpContext.Current.Server
> and then you add another dot :
>
> HttpContext.Current.Server. and you select MapPath
> which gives you HttpContext.Current.Server.MapPath
>
> 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" <> wrote in message
> news:B02B16E2-0595-4DB7-AF8B-...
> > No. They're not there. The only options are:
> >
> > AspNetHostingPermission
> > AspNetHostingPermissionAttributes
> > AspNetHostingPermissionLevel
> >
> > Do you know why?
> > --
> > Joe

>
> > "Juan T. Llibre" wrote:
> >
> >> Try :
> >>
> >> HttpContext.Current.Server.MapPath("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" <> wrote in message
> >> news:6AE7DADE-3A6A-470A-8EE9-...
> >> > Hello All;
> >> >
> >> > I can't access System.Web.HttpServerUtility from within a Class. I want to
> >> > have access to MapPath.
> >> >
> >> > What I get are three options. They are:
> >> >
> >> > AspNetHostingPermission
> >> > AspNetHostingPermissionAttributes
> >> > AspNetHostingPermissionLevel
> >> >
> >> > What gives? What did I miss?
> >> >
> >> > TIA,
> >> > --
> >> > Joe
> >> >
> >> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >>
> >>
> >>

>
>
>



=?Utf-8?B?Sm9l?=
  Reply With Quote
Old 10-27-2005, 07:03 PM   #9
Juan T. Llibre
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
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" <> wrote in message
news:40A0EBBD-F484-4E14-87B0-...
> 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:
>
> AspNetHostingPermission
> AspNetHostingPermissionAttributes
> AspNetHostingPermissionLevel
>
> --
> 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.Current and when you add another dot
>>
>> HttpContext.Current.
>>
>> You then select Server and get HttpContext.Current.Server
>> and then you add another dot :
>>
>> HttpContext.Current.Server. and you select MapPath
>> which gives you HttpContext.Current.Server.MapPath
>>
>> 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" <> wrote in message
>> news:B02B16E2-0595-4DB7-AF8B-...
>> > No. They're not there. The only options are:
>> >
>> > AspNetHostingPermission
>> > AspNetHostingPermissionAttributes
>> > AspNetHostingPermissionLevel
>> >
>> > Do you know why?
>> > --
>> > Joe

>>
>> > "Juan T. Llibre" wrote:
>> >
>> >> Try :
>> >>
>> >> HttpContext.Current.Server.MapPath("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" <> wrote in message
>> >> news:6AE7DADE-3A6A-470A-8EE9-...
>> >> > Hello All;
>> >> >
>> >> > I can't access System.Web.HttpServerUtility from within a Class. I want to
>> >> > have access to MapPath.
>> >> >
>> >> > What I get are three options. They are:
>> >> >
>> >> > AspNetHostingPermission
>> >> > AspNetHostingPermissionAttributes
>> >> > AspNetHostingPermissionLevel
>> >> >
>> >> > What gives? What did I miss?
>> >> >
>> >> > TIA,
>> >> > --
>> >> > Joe
>> >> >
>> >> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>> >>
>> >>
>> >>

>>
>>
>>





Juan T. Llibre
  Reply With Quote
Old 10-27-2005, 07:11 PM   #10
Juan T. Llibre
 
Posts: n/a
Default Re: Can't access System.Web.HttpServerUtility in class
Let me amend that answer.

You *can * type System...but it's not needed.

If you *do* type System. , then you'll need to select

Web.
HttpContext.
Current.
Server.
and
MapPath
before you write (" to write in the filename you want a physical path for.



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/
======================================

"Juan T. Llibre" <> wrote in message
news:%...
> 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" <> wrote in message
> news:40A0EBBD-F484-4E14-87B0-...
>> 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:
>>
>> AspNetHostingPermission
>> AspNetHostingPermissionAttributes
>> AspNetHostingPermissionLevel
>>
>> --
>> 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.Current and when you add another dot
>>>
>>> HttpContext.Current.
>>>
>>> You then select Server and get HttpContext.Current.Server
>>> and then you add another dot :
>>>
>>> HttpContext.Current.Server. and you select MapPath
>>> which gives you HttpContext.Current.Server.MapPath
>>>
>>> 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" <> wrote in message
>>> news:B02B16E2-0595-4DB7-AF8B-...
>>> > No. They're not there. The only options are:
>>> >
>>> > AspNetHostingPermission
>>> > AspNetHostingPermissionAttributes
>>> > AspNetHostingPermissionLevel
>>> >
>>> > Do you know why?
>>> > --
>>> > Joe
>>>
>>> > "Juan T. Llibre" wrote:
>>> >
>>> >> Try :
>>> >>
>>> >> HttpContext.Current.Server.MapPath("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" <> wrote in message
>>> >> news:6AE7DADE-3A6A-470A-8EE9-...
>>> >> > Hello All;
>>> >> >
>>> >> > I can't access System.Web.HttpServerUtility from within a Class. I want to
>>> >> > have access to MapPath.
>>> >> >
>>> >> > What I get are three options. They are:
>>> >> >
>>> >> > AspNetHostingPermission
>>> >> > AspNetHostingPermissionAttributes
>>> >> > AspNetHostingPermissionLevel
>>> >> >
>>> >> > What gives? What did I miss?
>>> >> >
>>> >> > TIA,
>>> >> > --
>>> >> > Joe
>>> >> >
>>> >> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>

>
>





Juan T. Llibre
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
70-536, 3 questions blade MCTS 11 03-23-2008 03:47 PM
I cant access the MCP site T3M4N MCTS 1 03-18-2008 06:21 PM
How To Access HTML elements in code behind??? nedums_b Software 1 02-07-2008 07:15 PM
Pix 515E Access ist issue ally0000 Hardware 0 01-12-2008 10:09 AM
attempt to access controls(fileupload,...) in designed page(.aspx) from class file subhashiniRuckmani Software 0 07-24-2007 01:03 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46