开发者

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

开发者 https://www.devze.com 2023-01-25 08:13 出处:网络
Ho开发者_StackOverfloww can I access the HttpServerUtility instance in ASP.NET MVC controller?\"this.httpContext.Server\" is a reference to HttpServerUtilityBase, the abstract class wrapper that\'s a

Ho开发者_StackOverfloww can I access the HttpServerUtility instance in ASP.NET MVC controller?


"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

精彩评论

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