mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
@@ -7,7 +7,7 @@
|
||||
@Html.TextBoxFor(m => m.Title, new { @class = "large text" })
|
||||
</fieldset>
|
||||
<fieldset class="permalink">
|
||||
<label class="sub" for="Slug">@T("Permalink")<br /><span>@Request.ToRootUrlString()/@Model.DisplayLeadingPath</span></label>
|
||||
<label class="sub" for="Slug">@T("Permalink")<br /><span>@Request.ToApplicationRootUrlString()/@Model.DisplayLeadingPath</span></label>
|
||||
<span>@Html.TextBoxFor(m => m.Slug, new { @class = "text" })</span>
|
||||
<span class="checkbox-and-label">
|
||||
@Html.EditorFor(m => m.PromoteToHomePage)
|
||||
|
@@ -1,39 +1,61 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Utility.Extensions {
|
||||
public static class HttpRequestExtensions {
|
||||
/// <summary>
|
||||
/// Returns the root part of a request.
|
||||
/// Returns the root part of a request.
|
||||
/// </summary>
|
||||
/// <example>http://localhost:3030</example>
|
||||
/// <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.
|
||||
/// Returns the root part of a request.
|
||||
/// </summary>
|
||||
/// <example>http://localhost:3030</example>
|
||||
/// <remarks>Prevents port number issues by using the client requested host</remarks>
|
||||
public static string ToRootUrlString(this HttpRequest request) {
|
||||
return string.Format("{0}://{1}", request.Url.Scheme, request.Headers["Host"]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the client requested url.
|
||||
/// Returns the application root part of a request.
|
||||
/// </summary>
|
||||
/// <example>http://localhost:3030/OrchardLocal</example>
|
||||
/// <remarks>Prevents port number issues by using the client requested host</remarks>
|
||||
public static string ToApplicationRootUrlString(this HttpRequestBase request) {
|
||||
string url = string.Format("{0}://{1}{2}", request.Url.Scheme, request.Headers["Host"], request.ApplicationPath);
|
||||
return url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the application root part of a request.
|
||||
/// </summary>
|
||||
/// <example>http://localhost:3030/OrchardLocal</example>
|
||||
/// <remarks>Prevents port number issues by using the client requested host</remarks>
|
||||
public static string ToApplicationRootUrlString(this HttpRequest request) {
|
||||
string url = string.Format("{0}://{1}{2}", request.Url.Scheme, request.Headers["Host"], request.ApplicationPath);
|
||||
return url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the client requested url.
|
||||
/// </summary>
|
||||
/// <example>http://localhost:3030/OrchardLocal/Admin/Blogs</example>
|
||||
/// <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.
|
||||
/// Returns the client requested url.
|
||||
/// </summary>
|
||||
/// <example>http://localhost:3030/OrchardLocal/Admin/Blogs</example>
|
||||
/// <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