[英]Problem accessing Server variable in static function in C#
Im unable to access server/response variable in my static function. 我无法在我的静态函数中访问服务器/响应变量。 Can i access them in static function or should i include some namespaces
我可以通过静态函数访问它们还是应该包含一些命名空间?
I'm having a really hard time understanding your question, but is it possible that you are looking for HttpContext.Current
? 我很难理解您的问题,但是您可能正在寻找
HttpContext.Current
吗?
var context = HttpContext.Current;
// now you can use context.Request, context.Response, context.Server, etc.
System.Web.HttpContext.Current
对象包括当前Server
, Response
, Request
等实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.