RestHashTracker/MamrRestHashTrackerModule.cs
/// <summary>
/// Generate the secure URL (original URL with hash)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
Generate the secure URL (original URL with hash)
Generate the secure URL ( original URL with hash )
private void HashGenerateSecureUrl(object sender, ObjectEventArgs e)
    {
        var url = e.Object.GetStringValue("HashUrl", string.Empty);
        var hashSecureUrl = "";
        var urlWithoutHash = URLHelper.RemoveParameterFromUrl(url, "hash");
        var newUrl = HttpUtility.UrlDecode(urlWithoutHash);
        var query = URLHelper.GetQuery(newUrl).TrimStart('?');
        int index = newUrl.IndexOfCSafe("/rest", true);
        if (index >= 0)
        {
            var domain = URLHelper.GetDomain(newUrl);
            newUrl = URLHelper.RemoveQuery(newUrl.Substring(index));
            var rewritten = BaseRESTService.RewriteRESTUrl(newUrl, query, domain, "GET");
            newUrl = rewritten[0].TrimStart('~') + "?" + rewritten[1];
            hashSecureUrl += URLHelper.AddParameterToUrl(urlWithoutHash, "hash", RESTService.GetHashForURL(newUrl, domain)) + Environment.NewLine;
            e.Object.SetValue("HashSecureUrl", hashSecureUrl);
        }
    }
private void HashGenerateSecureUrl ( object sender , ObjectEventArgs e ) { var url = e . Object . GetStringValue ( " " , string . Empty ) ; var hashSecureUrl = " " ; var urlWithoutHash = URLHelper . RemoveParameterFromUrl ( url , " " ) ; var newUrl = HttpUtility . UrlDecode ( urlWithoutHash ) ; var query = URLHelper . GetQuery ( newUrl ) . TrimStart ( ' ' ) ; int index = newUrl . IndexOfCSafe ( " " , true ) ; if ( index >= 0 ) { var domain = URLHelper . GetDomain ( newUrl ) ; newUrl = URLHelper . RemoveQuery ( newUrl . Substring ( index ) ) ; var rewritten = BaseRESTService . RewriteRESTUrl ( newUrl , query , domain , " " ) ; newUrl = rewritten [ 0 ] . TrimStart ( ' ' ) + " " + rewritten [ 1 ] ; hashSecureUrl += URLHelper . AddParameterToUrl ( urlWithoutHash , " " , RESTService . GetHashForURL ( newUrl , domain ) ) + Environment . NewLine ; e . Object . SetValue ( " " , hashSecureUrl ) ; } }
Generate the secure URL (original URL with hash)
Generate the secure URL ( original URL with hash )
sender
object
None
e
ObjectEventArgs
None