![]() |
|
|
|||||||
![]() |
ASP Net - Can't access System.Web.HttpServerUtility in class |
|
|
Thread Tools | Search this Thread |
|
|
#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?= |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
|
|
#4 |
|
Posts: n/a
|
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 |
|
|
|
#5 |
|
Posts: n/a
|
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?= |
|
|
|
#6 |
|
Posts: n/a
|
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 |
|
|
|
#7 |
|
Posts: n/a
|
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?= |
|
|
|
#8 |
|
Posts: n/a
|
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?= |
|
|
|
#9 |
|
Posts: n/a
|
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 |
|
|
|
#10 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |