The MVC framework: the RequireSslAttribute

Published Mon, Apr 6 2009 22:00

The RequireSslAttribute is a filter attribute which you can apply to a class or method and which is responsible for overriding the OnAuthorization method and seeing if the current request is being done over SSL. The filter exposes a single property, called Redirect.

When it detects that the current request is not under SSL, it checks the Redirect property: if it’s set to true, then it will build an https url based on the current request and redirect the user to that new url; if the Redirect property is set to false, then it will simply throw an exception.

And that’s all there is to know about this attribute. Keep tuned for more on the MVC framework.

Filed under: ,

Comments

# Mark Perry said on Tuesday, April 07, 2009 4:47 AM

Where does one find this attribute?

What namespace is it in?

Thanks, Mark

# luisabreu said on Tuesday, April 07, 2009 5:22 AM

It's on the futures bits. you have to download it and compile the source and then  drop the resulting assembly into your bin folder.

# Mark Perry said on Tuesday, April 07, 2009 5:54 AM

Cheers I grabbed it and made some changes to make it not check for "localhost" URL's whilst I was developing.

Leave a Comment

(required) 
(required) 
(optional)
(required)