Use a different port with RequireHttps filter in MVC2

僤鯓⒐⒋嵵緔 提交于 2019-12-11 04:08:03

问题


Is it possible to use [RequireHttps] filter with a different port other than 443? I can't find much documentation about it.


回答1:


Steve Sanderson's approach finally worked fine for me. No need to use the MVC2 filters.




回答2:


Subclass it and override HandleNonHttpsRequest(). From within that method, you can manipulate the URL as necessary. (For example, you can call base.HandleNonHttpsRequest(), then modify the filterContext.Result property to include a port number.) Then use [MyCustomRequireHttps] instead of [RequireHttps] on your actions.



来源:https://stackoverflow.com/questions/2736194/use-a-different-port-with-requirehttps-filter-in-mvc2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!