Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can't access System.Web.HttpServerUtility in class

Reply
Thread Tools

Can't access System.Web.HttpServerUtility in class

 
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      10-27-2005
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
 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-27-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Peter Rilling
Guest
Posts: n/a
 
      10-27-2005
You need an instance of that class to access the members. Nothing is
static.


"Joe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Peter Rilling
Guest
Posts: n/a
 
      10-27-2005
I guess in light of Juan's explaination, never mind.

"Peter Rilling" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> You need an instance of that class to access the members. Nothing is
> static.
>
>
> "Joe" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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

>
>



 
Reply With Quote
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      10-27-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-27-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      10-27-2005
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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > You need an instance of that class to access the members. Nothing is
> > static.
> >
> >
> > "Joe" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> 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

> >
> >

>
>
>

 
Reply With Quote
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      10-27-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > 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
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-27-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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" <(E-Mail Removed)> wrote in message
>> >> news:(E-Mail Removed)...
>> >> > 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
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      10-27-2005
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>> > 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" <(E-Mail Removed)> wrote in message
>>> >> news:(E-Mail Removed)...
>>> >> > 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
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>

>
>



 
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
why a class can't access protected method from another class in thesame package,the method is interited from the ohtner class from differntpackage? junzhang1983@gmail.com Java 3 01-28-2008 02:09 AM
Class A contains class B, class B points to class A Joseph Turian C++ 5 12-30-2005 03:24 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM
How do I let people access the internet via an access point but not allow them access to my network yar Wireless Networking 4 09-21-2004 03:48 AM



Advertisments