Server.MapPath问题 [英] Server.MapPath Problem

查看:98
本文介绍了Server.MapPath问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai all,

在我的课堂上,我尝试使用Server.MapPath,但是它说名称"Server"在当前上下文中不存在.如何解决此问题.
请帮助我.....

在此先感谢...
sham

hai all,

in my class, i am trying to use Server.MapPath, but it says the name ''Server'' does not exist in the current context.How can I fix this problem.
Plz help me.....

thanks in advance...
sham

推荐答案

具有System.Web的程序集引用,您将可以访问它.
此处了解详情. [
Have an Assembly reference of System.Web and you will be able to get access to it.

Read more about it here.[^]


如果是网站,您可以使用以下代码访问.cs文件中的对象

字符串strPath = System.Web.HttpContext.Current.Server.MapPath("YourDesired Path");
In Case Of Websites you can use following code to access that object in .cs file

string strPath = System.Web.HttpContext.Current.Server.MapPath("YourDesired Path");


这篇关于Server.MapPath问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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