无法在类中访问System.Web.HttpServerUtility [英] Can't access System.Web.HttpServerUtility in class

查看:58
本文介绍了无法在类中访问System.Web.HttpServerUtility的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All;


我无法从Class中访问System.Web.HttpServerUtility。我想

可以访问MapPath。


我得到的是三种选择。它们是:


AspNetHostingPermission

AspNetHostingPermissionAttributes

AspNetHostingPermissionLevel


给出了什么?我错过了什么?


TIA,

-

Joe


VB.NET/C#/ASP.NET/ASP/VB/C++/Web和DB开发/ VBA自动化

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

推荐答案

尝试:


HttpContext.Current.Server.MapPath(" filename.aspx")


Juan T. Llibre,ASP.NET MVP

ASP.NET常见问题解答: http://asp.net.do/ faq /

Foros de ASP.NET en Espa?ol: http://asp.net.do/foros/

======================= ===============

" Joe" <乔****** @ donotspam.yahoo.com>在消息中写道

新闻:6A ********************************** @ microsof t.com ...
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" <jo******@donotspam.yahoo.com> wrote in message
news:6A**********************************@microsof t.com...
Hello All;

我无法从类中访问System.Web.HttpServerUtility。我想
可以访问MapPath。

我得到的是三个选项。它们是:

AspNetHostingPermission
AspNetHostingPermissionAttributes
AspNetHostingPermissionLevel

是什么给出的?我错过了什么?

TIA,
-
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/ Web和DB开发/ VBA自动化
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



您需要该类的实例来访问成员。什么都不是

静态。

" Joe" <乔****** @ donotspam.yahoo.com>在消息中写道

新闻:6A ********************************** @ microsof t.com ...
You need an instance of that class to access the members. Nothing is
static.
"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:6A**********************************@microsof t.com...
Hello All;

我无法从类中访问System.Web.HttpServerUtility。我想
可以访问MapPath。

我得到的是三个选项。它们是:

AspNetHostingPermission
AspNetHostingPermissionAttributes
AspNetHostingPermissionLevel

是什么给出的?我错过了什么?

TIA,
-
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/ Web和数据库开发/ VBA自动化
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 < PE *** @ nospam.rilling.net>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
I guess in light of Juan''s explaination, never mind.

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
你需要该类的一个实例,用于访问成员。没有什么是静态的。

" Joe" <乔****** @ donotspam.yahoo.com>在消息中写道
新闻:6A ********************************** @ microsof t.com。 ..
You need an instance of that class to access the members. Nothing is
static.
"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:6A**********************************@microsof t.com...
Hello All;

我无法从类中访问System.Web.HttpServerUtility。我想
可以访问MapPath。

我得到的是三个选项。它们是:

AspNetHostingPermission
AspNetHostingPermissionAttributes
AspNetHostingPermissionLevel

是什么给出的?我错过了什么?

TIA,
-
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/ Web和DB开发/ VBA自动化
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




这篇关于无法在类中访问System.Web.HttpServerUtility的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆