Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ben 112 posts 398 karma points
    Apr 17, 2013 @ 22:07
    Ben
    0

    Sending Notifications Using HTTPS

    We are using Umbraco 4.7 and recently we switched over to using https and everything was running smothly.  However, we ran into a problem when the notifcations went out to users.  Previously the links looked similar to www.abc.com:80/umbraco... Now they were looking like www.abc.com:443/umbraco...  This would come across to the web server as http://www.abc.com:443/umbrcao... and the browser would hang or timeout.  I found that if in the browser I typed in https://www.abc.com:443/umbraco... everything was fine.  The solution to fix this was to change souce code.  

    File: Umbraco.cms -> workflow -> Notification.cs

    I replaced http://  with HttpContext.Current.Request.Url.Scheme + "://".

    private static void sendNotification

    line 124
                string[] subjectVars = {
                                           HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString() + IOHelper.ResolveUrl(SystemDirectories.Umbraco), ui.Text(Action.Alias)
                                           ,
                                           documentObject.Text
                                       };
    
                string[] bodyVars = {
                                        mailingUser.Name, ui.Text(Action.Alias), documentObject.Text, performingUser.Name,
                                        HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString() +IOHelper.ResolveUrl(SystemDirectories.Umbraco),
                                        documentObject.Id.ToString(), summary.ToString(), 
                                        String.Format(HttpContext.Current.Request.Url.Scheme + "://{0}/{1}", 
                                            HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString(), 
                                            /*umbraco.library.NiceUrl(documentObject.Id))*/ documentObject.Id.ToString() + ".aspx")
    
    
    
    private static string replaceLinks
    line 166
                string domain = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + ":" + HttpContext.Current.Request.Url.Port.ToString() + "/";
    
    File: (web server) \umbraco\config\lang\en.xml
    Replaced all http with https
    <area alias="notifications" version="2.1">
      ...
      <key alias="mailBody" version="2.1">
        ...
        Go to https://%4%/actions/editContent.aspx?id=%5% to edit.
        ...
      </key>
      <key alias="mailBodyHtml" version="3.0">
        ...
                    <a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="https://%4%/actions/publish.aspx?id=%5%">&nbsp;&nbsp;PUBLISH&nbsp;&nbsp;</a> &nbsp; 
                    <a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="https://%4%/actions/editContent.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EDIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a> &nbsp; 
                    <a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="https://%4%/actions/delete.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;DELETE&nbsp;&nbsp;&nbsp;&nbsp;</a>
        ...
      </key>
      ...
    </area>
Please Sign in or register to post replies

Write your reply to:

Draft