本文整理汇总了C#中System.Web.VirtualPath.Combine方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualPath.Combine方法的具体用法?C# VirtualPath.Combine怎么用?C# VirtualPath.Combine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.VirtualPath
的用法示例。
在下文中一共展示了VirtualPath.Combine方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapPath
internal String MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, bool allowCrossAppMapping) {
if (_wr == null)
throw new HttpException(SR.GetString(SR.Cannot_map_path_without_context));
// treat null as "."
//
if (virtualPath == null)
virtualPath = VirtualPath.Create(".");
VirtualPath originalVirtualPath = virtualPath; // remember for patch-up at the end
// Combine it with the base if one was passed in
if (baseVirtualDir != null) {
virtualPath = baseVirtualDir.Combine(virtualPath);
}
if (!allowCrossAppMapping)
virtualPath.FailIfNotWithinAppRoot();
string realPath = virtualPath.MapPathInternal();
// patch up the result for Everett combatibility (VSWhidbey 319826)
if (virtualPath.VirtualPathString == "/" &&
originalVirtualPath.VirtualPathString != "/" &&
!originalVirtualPath.HasTrailingSlash &&
UrlPath.PathEndsWithExtraSlash(realPath)) {
realPath = realPath.Substring(0, realPath.Length - 1);
}
InternalSecurityPermissions.PathDiscovery(realPath).Demand();
return realPath;
}
示例2: Combine
internal static VirtualPath Combine(VirtualPath v1, VirtualPath v2) {
// If the first is null, use the app root instead
if (v1 == null) {
v1 = HttpRuntime.AppDomainAppVirtualPathObject;
}
// If the first is still null, return the second, unless it's relative
if (v1 == null) {
v2.FailIfRelativePath();
return v2;
}
return v1.Combine(v2);
}
示例3: MapPathInternal
internal static string MapPathInternal(VirtualPath virtualPath, VirtualPath baseVirtualDir, bool allowCrossAppMapping)
{
virtualPath = baseVirtualDir.Combine(virtualPath);
if (!allowCrossAppMapping && !virtualPath.IsWithinAppRoot)
{
throw new ArgumentException(System.Web.SR.GetString("Cross_app_not_allowed", new object[] { virtualPath }));
}
return MapPathInternal(virtualPath);
}
示例4: MapPathInternal
internal static string MapPathInternal(VirtualPath virtualPath, VirtualPath baseVirtualDir, bool allowCrossAppMapping) {
Debug.Assert(baseVirtualDir != null, "baseVirtualDir != null");
// Combine it with the base and reduce
virtualPath = baseVirtualDir.Combine(virtualPath);
if (!allowCrossAppMapping && !virtualPath.IsWithinAppRoot)
throw new ArgumentException(SR.GetString(SR.Cross_app_not_allowed, virtualPath));
return MapPathInternal(virtualPath);
}
示例5: MapPath
internal string MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, bool allowCrossAppMapping)
{
if (this._wr == null)
{
throw new HttpException(System.Web.SR.GetString("Cannot_map_path_without_context"));
}
if (virtualPath == null)
{
virtualPath = VirtualPath.Create(".");
}
VirtualPath path = virtualPath;
if (baseVirtualDir != null)
{
virtualPath = baseVirtualDir.Combine(virtualPath);
}
if (!allowCrossAppMapping)
{
virtualPath.FailIfNotWithinAppRoot();
}
string str = virtualPath.MapPathInternal();
if (((virtualPath.VirtualPathString == "/") && (path.VirtualPathString != "/")) && (!path.HasTrailingSlash && UrlPath.PathEndsWithExtraSlash(str)))
{
str = str.Substring(0, str.Length - 1);
}
InternalSecurityPermissions.PathDiscovery(str).Demand();
return str;
}