Can't access System.Web.HttpServerUtility in class

Discussion in 'ASP .Net' started by =?Utf-8?B?Sm9l?=, Oct 27, 2005.

  1. 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?=, Oct 27, 2005
    #1
    1. Advertising

  2. 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:...
    > 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, Oct 27, 2005
    #2
    1. Advertising

  3. You need an instance of that class to access the members. Nothing is
    static.


    "Joe" <> wrote in message
    news:...
    > 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, Oct 27, 2005
    #3
  4. 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:...
    >> 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, Oct 27, 2005
    #4
  5. 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:...
    > > 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?=, Oct 27, 2005
    #5
  6. 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:...
    > 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:...
    >> > 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, Oct 27, 2005
    #6
  7. 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:...
    > >> 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?=, Oct 27, 2005
    #7
  8. 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:...
    > > 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:...
    > >> > 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?=, Oct 27, 2005
    #8
  9. 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:...
    > 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:...
    >> > 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:...
    >> >> > 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, Oct 27, 2005
    #9
  10. 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:...
    >> 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:...
    >>> > 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:...
    >>> >> > 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, Oct 27, 2005
    #10
  11. Juan,

    Thanks. I understadn all of this. Please remember that I said that I am
    tryignt o do this ina class. I am not tryign to do this in a webpage
    cpde-behind.

    From within the class, HttpContext is not even recognized.
    --
    Joe

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


    "Juan T. Llibre" wrote:

    > 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:...
    > >> 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:...
    > >>> > 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:...
    > >>> >> > 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?=, Oct 27, 2005
    #11
  12. 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" <> wrote in message
    > news:...
    > > 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:...
    > >> > 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:...
    > >> >> > 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?=, Oct 27, 2005
    #12
  13. Are you trying to use it from a different assembly from your main site? Is
    so, you may need to add a reference to the System.Web.dll assembly.

    "Joe" <> wrote in message
    news:...
    > Juan,
    >
    > Thanks. I understadn all of this. Please remember that I said that I am
    > tryignt o do this ina class. I am not tryign to do this in a webpage
    > cpde-behind.
    >
    > From within the class, HttpContext is not even recognized.
    > --
    > Joe
    >
    > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
    >
    >
    > "Juan T. Llibre" wrote:
    >
    >> 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:...
    >> >> 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:...
    >> >>> > 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:...
    >> >>> >> > 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, Oct 27, 2005
    #13
  14. re:
    > 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).


    I understand what you're saying, but it doesn't reflect what I experience.
    I tested that in a class file, not in a code-behind aspx page.

    re:
    > This may have everything to do with where I am trying to do this.


    No, it does not.

    Maybe you have a damaged VS ?
    What version of VS are you using ?




    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:...
    > 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" <> wrote in message
    >> news:...
    >> > 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:...
    >> >> > 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:...
    >> >> >> > 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?
     
    Juan T. Llibre, Oct 27, 2005
    #14
  15. Peter,

    That's it! When I look in the references, I don't see System.Web; I see
    System. I added System.Web and I'm on my way.

    Thank youa nd thank you to Juan!.

    Would you please help me to understand this? What I taek from this is that
    having a reference to System is not adequate because the functionality that I
    want is actually located in a different assembly. Is this correct? Did I
    express it correctly?

    Thanks again.
    --
    Joe

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


    "Peter Rilling" wrote:

    > Are you trying to use it from a different assembly from your main site? Is
    > so, you may need to add a reference to the System.Web.dll assembly.
    >
    > "Joe" <> wrote in message
    > news:...
    > > Juan,
    > >
    > > Thanks. I understadn all of this. Please remember that I said that I am
    > > tryignt o do this ina class. I am not tryign to do this in a webpage
    > > cpde-behind.
    > >
    > > From within the class, HttpContext is not even recognized.
    > > --
    > > Joe
    > >
    > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
    > >
    > >
    > > "Juan T. Llibre" wrote:
    > >
    > >> 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:...
    > >> >> 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:...
    > >> >>> > 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:...
    > >> >>> >> > 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?=, Oct 27, 2005
    #15
  16. Juan,

    Please see my reply to Peter. Thank you for your help. I appreciate your
    efforts.

    The problem was that I didn't have a refernece set to the System.Web assembly.
    --
    Joe

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


    "Juan T. Llibre" wrote:

    > re:
    > > 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).

    >
    > I understand what you're saying, but it doesn't reflect what I experience.
    > I tested that in a class file, not in a code-behind aspx page.
    >
    > re:
    > > This may have everything to do with where I am trying to do this.

    >
    > No, it does not.
    >
    > Maybe you have a damaged VS ?
    > What version of VS are you using ?
    >
    >
    >
    >
    > 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:...
    > > 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" <> wrote in message
    > >> news:...
    > >> > 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:...
    > >> >> > 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:...
    > >> >> >> > 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?

    >
    >
    >
     
    =?Utf-8?B?Sm9l?=, Oct 27, 2005
    #16
  17. Hi, Joe.

    Glad to see that Peter hit the nail on its head.

    System and System.Web are two different assemblies.

    See the System assembly :

    http://beta.asp.net/QUICKSTART/util/classbrowser.aspx?namespace=System

    Now, see the System.Web assembly :
    http://beta.asp.net/QUICKSTART/util/classbrowser.aspx?namespace=System.Web

    Two totally different assemblies...

    Also, if you look in your .Net Framework directory :
    drive:\WINDOWS\Microsoft.NET\Framework\vx.x.xxxxx
    you'll see that there's different dll's for them : system.dll and system.web.dll

    Glad to see that you're on the good track again.

    ;-)




    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:D...
    > Peter,
    >
    > That's it! When I look in the references, I don't see System.Web; I see
    > System. I added System.Web and I'm on my way.
    >
    > Thank youa nd thank you to Juan!.
    >
    > Would you please help me to understand this? What I taek from this is that
    > having a reference to System is not adequate because the functionality that I
    > want is actually located in a different assembly. Is this correct? Did I
    > express it correctly?
    >
    > Thanks again.
    > --
    > Joe
    >
    > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
    >
    >
    > "Peter Rilling" wrote:
    >
    >> Are you trying to use it from a different assembly from your main site? Is
    >> so, you may need to add a reference to the System.Web.dll assembly.
    >>
    >> "Joe" <> wrote in message
    >> news:...
    >> > Juan,
    >> >
    >> > Thanks. I understadn all of this. Please remember that I said that I am
    >> > tryignt o do this ina class. I am not tryign to do this in a webpage
    >> > cpde-behind.
    >> >
    >> > From within the class, HttpContext is not even recognized.
    >> > --
    >> > Joe
    >> >
    >> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
    >> >
    >> >
    >> > "Juan T. Llibre" wrote:
    >> >
    >> >> 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:...
    >> >> >> 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:...
    >> >> >>> > 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:...
    >> >> >>> >> > 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, Oct 27, 2005
    #17
  18. Thanks.

    I appreciate all of your help.
    --
    Joe

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


    "Juan T. Llibre" wrote:

    > Hi, Joe.
    >
    > Glad to see that Peter hit the nail on its head.
    >
    > System and System.Web are two different assemblies.
    >
    > See the System assembly :
    >
    > http://beta.asp.net/QUICKSTART/util/classbrowser.aspx?namespace=System
    >
    > Now, see the System.Web assembly :
    > http://beta.asp.net/QUICKSTART/util/classbrowser.aspx?namespace=System.Web
    >
    > Two totally different assemblies...
    >
    > Also, if you look in your .Net Framework directory :
    > drive:\WINDOWS\Microsoft.NET\Framework\vx.x.xxxxx
    > you'll see that there's different dll's for them : system.dll and system.web.dll
    >
    > Glad to see that you're on the good track again.
    >
    > ;-)
    >
    >
    >
    >
    > 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:D...
    > > Peter,
    > >
    > > That's it! When I look in the references, I don't see System.Web; I see
    > > System. I added System.Web and I'm on my way.
    > >
    > > Thank youa nd thank you to Juan!.
    > >
    > > Would you please help me to understand this? What I taek from this is that
    > > having a reference to System is not adequate because the functionality that I
    > > want is actually located in a different assembly. Is this correct? Did I
    > > express it correctly?
    > >
    > > Thanks again.
    > > --
    > > Joe
    > >
    > > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
    > >
    > >
    > > "Peter Rilling" wrote:
    > >
    > >> Are you trying to use it from a different assembly from your main site? Is
    > >> so, you may need to add a reference to the System.Web.dll assembly.
    > >>
    > >> "Joe" <> wrote in message
    > >> news:...
    > >> > Juan,
    > >> >
    > >> > Thanks. I understadn all of this. Please remember that I said that I am
    > >> > tryignt o do this ina class. I am not tryign to do this in a webpage
    > >> > cpde-behind.
    > >> >
    > >> > From within the class, HttpContext is not even recognized.
    > >> > --
    > >> > Joe
    > >> >
    > >> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
    > >> >
    > >> >
    > >> > "Juan T. Llibre" wrote:
    > >> >
    > >> >> 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:...
    > >> >> >> 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:...
    > >> >> >>> > 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:...
    > >> >> >>> >> > 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?=, Oct 27, 2005
    #18
  19. =?Utf-8?B?Sm9l?=

    fred500

    Joined:
    Mar 29, 2008
    Messages:
    1
    I had the same problem.

    I added "stystem.web" reference to my project then it work.
     
    fred500, Mar 29, 2008
    #19
  20. =?Utf-8?B?Sm9l?=

    Daryn

    Joined:
    May 22, 2008
    Messages:
    1
    This worked for me

    var encodedValue = HttpContext.Current.Server.UrlEncode(value);

    And this is not in a ascx.cs file, it is in a normal cs file...
     
    Daryn, May 22, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Supriya
    Replies:
    0
    Views:
    461
    Supriya
    Jul 1, 2003
  2. Brendan Erwin

    HttpServerUtility.GetLastError Timing issue?

    Brendan Erwin, Dec 2, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    532
    bruce barker
    Dec 2, 2003
  3. =?Utf-8?B?UGF0cmljayBG?=

    How to use HttpServerUtility?

    =?Utf-8?B?UGF0cmljayBG?=, Feb 14, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    23,054
    isaiyavan
    Jul 4, 2008
  4. =?Utf-8?B?QXJuZQ==?=

    HttpServerUtility instance method

    =?Utf-8?B?QXJuZQ==?=, Aug 17, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    406
    =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?=
    Aug 17, 2007
  5. Arne

    HttpServerUtility

    Arne, Aug 4, 2009, in forum: ASP .Net
    Replies:
    5
    Views:
    783
    Gregory A. Beamer
    Aug 5, 2009
Loading...

Share This Page