How do I enable SSL for a particular section of an Umbraco (v4+) site? IIS requires that you select the folder but of course, it doesn't actually exist!?
Hi Gordon, long time ago I wrote a control which check by a true/fals property if the site needed https and redirects to itself with https. the control was made for v3, but should work similiar in v4. I can give you the code (if I find it) or I can do a package ou of this if wanted.
I researched this about a year ago, andthere was talk then that v4 handles this out the box. That said - we implemented a solution based upon this dll:
I usually create a true/false generic property on my base document type called "useSSL", then I drop a user control onto my master template with the following code:
protected void Page_Load(object sender, EventArgs e) { Node n = Node.GetCurrent(); int useSSL; if (n.GetProperty("useSSL") != null) { int.TryParse(n.GetProperty("useSSL").Value, out useSSL); } else { useSSL = 0; } if (useSSL > 0) { if (!Request.IsSecureConnection) { Response.Redirect(Request.Url.ToString().Replace("http:", "https:")); } } else { if (Request.IsSecureConnection) { Response.Redirect(Request.Url.ToString().Replace("https:", "http:")); } } }
I can then individually select which pages I want to secure.
The solution from Ricky is nearly the same as mine. Additional to that code above I had a three state property (ForceHTTPS, ForceHTTP, Both) which could also redirect to non SSL.
I am sorry, I misread your previous post. I am not sure if you can place it in a script block in the master template itself (as opposed to a script block in a ascx file). Did you import the correct Umbraco namespace at the top of your template?
I have tried your code and it looks good to me, now can Ricky or someone please let me know how to configure IIS7 so that only the donations page is on SSL and rest of the umbraco web site runs on http url.
Enable SSL / HTTPS
How do I enable SSL for a particular section of an Umbraco (v4+) site? IIS requires that you select the folder but of course, it doesn't actually exist!?
Hi Gordon, long time ago I wrote a control which check by a true/fals property if the site needed https and redirects to itself with https. the control was made for v3, but should work similiar in v4. I can give you the code (if I find it) or I can do a package ou of this if wanted.
hth, Thomas
Hi Thomas - this seems like something that should be built into Umbraco. It's hard to believe that no one else has needed to do this!
I could do with something fairly quickly, so either the code or a package would be greatly received :-)
Will pull it out of my data graves in the cellar this evening. huh, frightened to see that old code...
Thomas
Gordon, I believe you could also use a URL rewriting filter like this one:
ISAPI Rewrite
You could then do a permanent (301) redirect to the https version of the page.
Hi
I researched this about a year ago, andthere was talk then that v4 handles this out the box. That said - we implemented a solution based upon this dll:
http://www.codeproject.com/KB/aspnet/WebPageSecurity.aspx?fid=29017&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=101
on the old forum there was instructions on ho to modify this for use within umbraco (couldn't find the thread). It was not difficult to do.
I dont seem to get notifications of comments from this forum, so email me if you would like more detail om how it was done. It Works very well for us
I usually create a true/false generic property on my base document type called "useSSL", then I drop a user control onto my master template with the following code:
I can then individually select which pages I want to secure.
Ricky - did you create a ascx / dll or did you put the code directly into the template (in a script block)?
I use an ascx, but I don't see why you couldn't use a script block.
The solution from Ricky is nearly the same as mine. Additional to that code above I had a three state property (ForceHTTPS, ForceHTTP, Both) which could also redirect to non SSL.
Thomas
Ricky - I tried putting a script block in the master template but it complained that it did not know what "Node" was?
Thomas - I would still be interested in seeing your code as well, if you don't mind?
I am sorry, I misread your previous post. I am not sure if you can place it in a script block in the master template itself (as opposed to a script block in a ascx file). Did you import the correct Umbraco namespace at the top of your template?
Also, are you unable to use a user control for some reason?
I have upgraded my old code (only small polishing to work with v4 umbraco items) and uploaded it as a new project: http://our.umbraco.org/projects/force-ssl
The Solution is also added
hth,
Thomas
Hi Ricky Beard
Umbraco: version 4.0
OS: win 2008R2 Server
I have tried your code and it looks good to me, now can Ricky or someone please let me know how to configure IIS7 so that only the donations page is on SSL and rest of the umbraco web site runs on http url.
Many Thanks for your help in advance.
Kind Regards.
is working on a reply...