How can I access the HttpServerUtility instance in ASP.NET MVC controller?

后端 未结 1 456
醉酒成梦
醉酒成梦 2021-02-07 08:23

How can I access the HttpServerUtility instance in ASP.NET MVC controller?

相关标签:
1条回答
  • 2021-02-07 08:56

    "this.httpContext.Server" is a reference to HttpServerUtilityBase, the abstract class wrapper that's a part of the System.Web.Abstractions DLL. You can also do:

    HttpContext.Current.Server
    

    To directly access the "old-school" way. Also you can get an instance of the base class using the wrapper by doing the following:

    new HttpServerUtilityWrapper(HttpContext.Current.Server)
    

    The wrapper class inherits from httpServerUtilityBase

    0 讨论(0)
提交回复
热议问题