mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Corrected more port issues in generated urls on Azure hosting
Was preventing Live Writer from auto onfiguring. Replace all Request.Url occurences --HG-- branch : dev
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Comments.Extensions {
|
||||
public static class HtmlHelperExtensions {
|
||||
@@ -23,7 +24,7 @@ namespace Orchard.Comments.Extensions {
|
||||
Area = "Orchard.Comments",
|
||||
Controller = "Admin",
|
||||
id = item.Id,
|
||||
returnUrl = html.ViewContext.HttpContext.Request.Url
|
||||
returnUrl = html.ViewContext.HttpContext.Request.ToUrlString()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<%@ Import Namespace="Orchard.Comments"%>
|
||||
<%@ Import Namespace="Orchard.Security" %>
|
||||
<%@ Import Namespace="Orchard.Comments.Models" %>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||
<%-- todo: clean up this template - waaay too much going on in here :/ --%><%
|
||||
if (Model.Comments.Count > 0) { %>
|
||||
<h2 id="comments"><%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%></h2>
|
||||
@@ -51,7 +52,7 @@ else { %>
|
||||
<div>
|
||||
<input type="submit" class="button" value="<%=_Encoded("Submit Comment") %>" />
|
||||
<%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.ToUrlString()) %>
|
||||
<%=Html.AntiForgeryTokenOrchard() %>
|
||||
</div>
|
||||
</fieldset><%
|
||||
|
||||
@@ -5,6 +5,7 @@ using JetBrains.Annotations;
|
||||
using Orchard.Core.XmlRpc;
|
||||
using Orchard.Core.XmlRpc.Models;
|
||||
using Orchard.Security;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Media.Services {
|
||||
[UsedImplicitly]
|
||||
@@ -18,7 +19,7 @@ namespace Orchard.Media.Services {
|
||||
}
|
||||
|
||||
public void Process(XmlRpcContext context) {
|
||||
var uriBuilder = new UriBuilder(context.HttpContext.Request.Url) {
|
||||
var uriBuilder = new UriBuilder(context.HttpContext.Request.ToUrlString()) {
|
||||
Path = context.HttpContext.Request.ApplicationPath,
|
||||
Query = string.Empty
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Orchard.Themes.DesignerNotes {
|
||||
Controller = "Admin",
|
||||
context.ZoneName,
|
||||
theme.ThemeName,
|
||||
ReturnUrl = requestContext.HttpContext.Request.Url,
|
||||
ReturnUrl = requestContext.HttpContext.Request.RawUrl,
|
||||
}));
|
||||
writer.Write("</div>");
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ html.dyn #themepreview button.preview { display:none; }
|
||||
<% using(Html.BeginFormAntiForgeryPost(Url.Action("Preview", new{Controller="Admin", Area="Orchard.Themes"}), FormMethod.Post, new { @class = "inline" })) { %>
|
||||
<fieldset>
|
||||
<span><%=T("You are previewing: ")%></span>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.Url)%>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.RawUrl)%>
|
||||
<%=Html.DropDownList("ThemeName", Model.Themes, new {onChange = "this.form.submit();"})%>
|
||||
<button type="submit" class="preview" title="<%=_Encoded("Preview")%>" name="submit.Preview" value="<%=_Encoded("Preview")%>"><%=_Encoded("Preview")%></button>
|
||||
<button type="submit" title="<%=_Encoded("Apply")%>" name="submit.Apply" value="<%=_Encoded("Apply")%>"><%=_Encoded("Apply this theme") %></button>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<BaseViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%><%
|
||||
var menu = Model.Menu.FirstOrDefault();
|
||||
@@ -14,7 +15,7 @@
|
||||
if (counter == count)
|
||||
sbClass.Append("last ");
|
||||
|
||||
if (string.Equals(menuItem.Href, Request.Url.AbsolutePath, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (string.Equals(menuItem.Href, Request.ToUrlString(), StringComparison.InvariantCultureIgnoreCase))
|
||||
sbClass.Append("current ");
|
||||
|
||||
var classValue = sbClass.ToString().TrimEnd(); %>
|
||||
|
||||
@@ -51,7 +51,7 @@ else { %>
|
||||
<div>
|
||||
<input type="submit" class="button" value="<%=_Encoded("Submit Comment") %>" />
|
||||
<%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.RawUrl) %>
|
||||
<%=Html.AntiForgeryTokenOrchard() %>
|
||||
</div>
|
||||
</fieldset><%
|
||||
|
||||
@@ -51,7 +51,7 @@ else { %>
|
||||
<div>
|
||||
<input type="submit" class="button" value="<%=_Encoded("Submit Comment") %>" />
|
||||
<%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
||||
<%=Html.Hidden("ReturnUrl", Context.Request.RawUrl) %>
|
||||
<%=Html.AntiForgeryTokenOrchard() %>
|
||||
</div>
|
||||
</fieldset><%
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Mvc.Extensions {
|
||||
public static class UrlHelperExtensions {
|
||||
@@ -8,7 +9,7 @@ namespace Orchard.Mvc.Extensions {
|
||||
}
|
||||
|
||||
private static string MakeAbsolute(this UrlHelper urlHelper, string url) {
|
||||
var siteUrl = urlHelper.RequestContext.HttpContext.Request.Url.GetLeftPart(UriPartial.Authority);
|
||||
var siteUrl = urlHelper.RequestContext.HttpContext.Request.ToRootUrlString();
|
||||
return siteUrl + url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,14 @@ using System.Web;
|
||||
|
||||
namespace Orchard.Utility.Extensions {
|
||||
public static class HttpRequestExtensions {
|
||||
/// <summary>
|
||||
/// Returns the root part of a request.
|
||||
/// </summary>
|
||||
/// <remarks>Prevents port number issues by using the client requested host</remarks>
|
||||
public static string ToRootUrlString(this HttpRequestBase request) {
|
||||
return string.Format("{0}://{1}", request.Url.Scheme, request.Headers["Host"]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the root part of a request.
|
||||
/// </summary>
|
||||
@@ -9,5 +17,22 @@ namespace Orchard.Utility.Extensions {
|
||||
public static string ToRootUrlString(this HttpRequest request) {
|
||||
return string.Format("{0}://{1}", request.Url.Scheme, request.Headers["Host"]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the client requested url.
|
||||
/// </summary>
|
||||
/// <remarks>Prevents port number issues by using the client requested host</remarks>
|
||||
public static string ToUrlString(this HttpRequestBase request) {
|
||||
return string.Format("{0}://{1}{2}", request.Url.Scheme, request.Headers["Host"], request.RawUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the client requested url.
|
||||
/// </summary>
|
||||
/// <remarks>Prevents port number issues by using the client requested host</remarks>
|
||||
public static string ToUrlString(this HttpRequest request) {
|
||||
return string.Format("{0}://{1}{2}", request.Url.Scheme, request.Headers["Host"], request.RawUrl);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user