Is it possible to turn off ssl at the controller level of an ASP.Net MVC application? -


is there way maybe via action filter turn off ssl specific methods?

example...if somehow hits index method , has ssl on...can redirect method again , turn off?

global.asax.cs

protected void application_beginrequest(){     if (context.request.issecureconnection)         response.redirect(context.request.url.tostring().replace("https:", "http:")); } 

you add same code action filter:

public class sslfilter : actionfilterattribute {      public override void onactionexecuting(actionexecutingcontext filtercontext){         if (filtercontext.httpcontext.request.issecureconnection){             var url = filtercontext.httpcontext.request.url.tostring().replace("https:", "http:");             filtercontext.result = new redirectresult(url);         }     } } 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -