Reputation: 85855
I am wondering how do I make pages automatically use https? Like if a user types in
It should take them right to the login page. However I have SSL required on this page(when they try to login).
So how could I make it so it would change it to
https://www.mysite.com even if they don't type it in themselfs?
Upvotes: 4
Views: 1323
Reputation: 9993
i believe you are looking for
[RequireSsl(Redirect = true)]
there is a discussion you can find here
Edited: found this link might be useful
http://blog.stevensanderson.com/2008/08/05/adding-httpsssl-support-to-aspnet-mvc-routing/
Upvotes: 1
Reputation: 269618
You can use the RequireHttpsAttribute
on the appropriate controllers and/or actions:
[RequireHttps]
public class SecureController : Controller
{
public ActionResult YourAction()
{
// ...
}
}
// ...
public class YourController : Controller
{
[RequireHttps]
public ActionResult SecureAction()
{
// ...
}
}
Upvotes: 3