mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00

Complications with login make this impractical for the time being, but mechanically it does work to some extent. --HG-- branch : dev
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.Web;
|
|
using Orchard.Mvc.Wrappers;
|
|
|
|
namespace Orchard.Mvc.Routes {
|
|
public class UrlPrefixAdjustedHttpContext : HttpContextBaseWrapper {
|
|
private readonly UrlPrefix _prefix;
|
|
|
|
public UrlPrefixAdjustedHttpContext(HttpContextBase httpContextBase, UrlPrefix prefix)
|
|
: base(httpContextBase) {
|
|
_prefix = prefix;
|
|
}
|
|
|
|
public override HttpRequestBase Request {
|
|
get {
|
|
return new AdjustedRequest(_httpContextBase.Request, _prefix);
|
|
}
|
|
}
|
|
|
|
class AdjustedRequest : HttpRequestBaseWrapper {
|
|
private readonly UrlPrefix _prefix;
|
|
|
|
public AdjustedRequest(HttpRequestBase httpRequestBase, UrlPrefix prefix)
|
|
: base(httpRequestBase) {
|
|
_prefix = prefix;
|
|
}
|
|
|
|
public override string AppRelativeCurrentExecutionFilePath {
|
|
get {
|
|
return _prefix.RemoveLeadingSegments(_httpRequestBase.AppRelativeCurrentExecutionFilePath);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|