当前位置: 首页>>代码示例>>C#>>正文


C# VirtualPath.Combine方法代码示例

本文整理汇总了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;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:33,代码来源:HttpRequest.cs

示例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);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:VirtualPath.cs

示例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);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:HostingEnvironment.cs

示例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);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:11,代码来源:HostingEnvironment.cs

示例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;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:HttpRequest.cs


注:本文中的System.Web.VirtualPath.Combine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。