如何在独立类文件中添加System.web.Httpcontext引用 [英] How to add System.web.Httpcontext reference in standalone class file

查看:1267
本文介绍了如何在独立类文件中添加System.web.Httpcontext引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
i已在我的类文件中添加了一个引用system.web dll并使用命名空间调用它

使用system .web.my问题是我无法使用system.web调用.httpcontext命名空间所以我是

我的代码类型或namaspace中出现错误httpcontext找不到。如果知道如何添加

参考使用system.web.httpcontext hel我这里是我的代码





// StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath( prequal.xml));

解决方案

首先 HttpContext 是一个Class not namespace。



http:// msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx



您是否添加了系统的DLL参考。项目中的Web.dll

http:// msdn .microsoft.com / EN-US /库/ wkze6zky.aspx

hi i already added a reference system.web dll in my class file and call it using namespace
using system .web.my problem is i can't call using system.web.httpcontext namespace so i am
getting error in my code type or namaspace httpcontext is not found.if any knows how to add
reference for using system.web.httpcontext hel me here is my code


//StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath("prequal.xml"));

解决方案

Firstly HttpContext is a Class not namespace.

http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx

Have you added DLL reference of System.Web.dll in your Project?
http://msdn.microsoft.com/en-us/library/wkze6zky.aspx


这篇关于如何在独立类文件中添加System.web.Httpcontext引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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