开发者

Problem accessing Server variable in static function in C#

开发者 https://www.devze.com 2023-01-16 16:32 出处:网络
Im unable to access server/response varia开发者_运维问答ble in my static function. Can i access them in static function or should i include some namespacesI\'m having a really hard time understanding

Im unable to access server/response varia开发者_运维问答ble 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?

var context = HttpContext.Current;
// now you can use context.Request, context.Response, context.Server, etc.


System.Web.HttpContext.Current object includes current Server, Response, Request etc instances.

0

精彩评论

暂无评论...
验证码 换一张
取 消