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


C# VirtualPath.MapPathInternal方法代码示例

本文整理汇总了C#中System.Web.VirtualPath.MapPathInternal方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualPath.MapPathInternal方法的具体用法?C# VirtualPath.MapPathInternal怎么用?C# VirtualPath.MapPathInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.VirtualPath的用法示例。


在下文中一共展示了VirtualPath.MapPathInternal方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ComputeSourceDependenciesHashCode

 internal override string ComputeSourceDependenciesHashCode(VirtualPath virtualPath)
 {
     if (virtualPath == null)
     {
         virtualPath = base.VirtualPath;
     }
     HashCodeCombiner combiner = new HashCodeCombiner();
     combiner.AddResourcesDirectory(virtualPath.MapPathInternal());
     return combiner.CombinedHashString;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:BuildResultResourceAssembly.cs

示例2: InternalRewritePath

        internal void InternalRewritePath(VirtualPath newFilePath, VirtualPath newPathInfo,
            String newQueryString, bool setClientFilePath) {
            // clear things that depend on path
            _pathTranslated = (_wr != null) ? newFilePath.MapPathInternal() : null;
            _pathInfo = newPathInfo;
            _filePath = newFilePath;
            _url = null;
            Unvalidated.InvalidateUrl();

            // DevDiv 

            string temp = RawUrl;

            if (newPathInfo == null) {
                _path = newFilePath;
            }
            else {
                // Combine the file path and the pathInfo to get the path.  Note that we can't call
                // newFilePath.Combine here, since the rules are very different here (VSWhidbey 498926, 528055)
                string newFullPathString = newFilePath.VirtualPathStringWhicheverAvailable + "/" + newPathInfo.VirtualPathString;
                _path = VirtualPath.Create(newFullPathString);
            }

            if (newQueryString != null)
                this.QueryStringText = newQueryString;

            // remember the rewritten url
            _rewrittenUrl = _path.VirtualPathString;
            string q = QueryStringText;
            if (!String.IsNullOrEmpty(q))
                _rewrittenUrl += "?" + q;

            // no need to calculate any paths
            _computePathInfo = false;

            if (setClientFilePath) {
                _clientFilePath = newFilePath;
            }

            IIS7WorkerRequest iis7WorkerRequest = _wr as IIS7WorkerRequest;
            if (iis7WorkerRequest != null) {
                String newPath = (_path != null && _path.VirtualPathString != null) ? _path.VirtualPathString : String.Empty;
                iis7WorkerRequest.RewriteNotifyPipeline(newPath, newQueryString, setClientFilePath);
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:45,代码来源:HttpRequest.cs

示例3: 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

示例4: GetPhysicalPath

        // Ensure that the physical path does not look suspicious (MSRC 5556).
        static private string GetPhysicalPath(VirtualPath virtualPath) {
            string physicalPath = null;
            try {
                physicalPath = virtualPath.MapPathInternal(true);
            }
            catch (HttpException e) {
                //
                // Treat exceptions that are thrown because the path is suspicious
                // as "404 Not Found" exceptions. Implementations of MapPath
                // will throw HttpException with no error code if the path is
                // suspicious.
                //
                if (e.GetHttpCode() == 500) {
                    throw new HttpException(404, String.Empty);
                }
                else {
                    throw;
                }
            }

            //
            // Throw "404 Not Found" if the path is suspicious and 
            // the implementation of MapPath has not already done so.
            //
            FileUtil.CheckSuspiciousPhysicalPath(physicalPath);

            return physicalPath;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:29,代码来源:CachedPathData.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

示例6: InternalRewritePath

 internal void InternalRewritePath(VirtualPath newFilePath, VirtualPath newPathInfo, string newQueryString, bool setClientFilePath)
 {
     this._pathTranslated = (this._wr != null) ? newFilePath.MapPathInternal() : null;
     this._pathInfo = newPathInfo;
     this._filePath = newFilePath;
     this._url = null;
     string rawUrl = this.RawUrl;
     if (newPathInfo == null)
     {
         this._path = newFilePath;
     }
     else
     {
         string virtualPath = newFilePath.VirtualPathStringWhicheverAvailable + "/" + newPathInfo.VirtualPathString;
         this._path = VirtualPath.Create(virtualPath);
     }
     if (newQueryString != null)
     {
         this.QueryStringText = newQueryString;
     }
     this._rewrittenUrl = this._path.VirtualPathString;
     string queryStringText = this.QueryStringText;
     if (!string.IsNullOrEmpty(queryStringText))
     {
         this._rewrittenUrl = this._rewrittenUrl + "?" + queryStringText;
     }
     this._computePathInfo = false;
     if (setClientFilePath)
     {
         this._clientFilePath = newFilePath;
     }
     IIS7WorkerRequest request = this._wr as IIS7WorkerRequest;
     if (request != null)
     {
         string newPath = ((this._path != null) && (this._path.VirtualPathString != null)) ? this._path.VirtualPathString : string.Empty;
         request.RewriteNotifyPipeline(newPath, newQueryString, setClientFilePath);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:38,代码来源:HttpRequest.cs

示例7: VirtualFileExistsWithAssert

 internal static bool VirtualFileExistsWithAssert(VirtualPath virtualPath)
 {
     string path = virtualPath.MapPathInternal();
     if (path != null)
     {
         InternalSecurityPermissions.PathDiscovery(path).Assert();
     }
     return virtualPath.FileExists();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:Util.cs

示例8: VirtualDirectoryExistsWithAssert

 private static bool VirtualDirectoryExistsWithAssert(VirtualPath virtualDir)
 {
     try
     {
         string path = virtualDir.MapPathInternal();
         if (path != null)
         {
             new FileIOPermission(FileIOPermissionAccess.Read, path).Assert();
         }
         return virtualDir.DirectoryExists();
     }
     catch
     {
         return false;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:Util.cs

示例9: OpenFileAndGetDependency

 internal Stream OpenFileAndGetDependency(VirtualPath virtualPath, string physicalPath, out CacheDependency dependency)
 {
     Stream stream;
     if ((physicalPath == null) && HostingEnvironment.UsingMapPathBasedVirtualPathProvider)
     {
         physicalPath = virtualPath.MapPathInternal(this.TemplateControlVirtualDirectory, true);
     }
     if (physicalPath != null)
     {
         HttpRuntime.CheckFilePermission(physicalPath);
         stream = new FileStream(physicalPath, FileMode.Open, FileAccess.Read, FileShare.Read);
         dependency = new CacheDependency(0, physicalPath);
         return stream;
     }
     stream = virtualPath.OpenFile();
     dependency = VirtualPathProvider.GetCacheDependency(virtualPath);
     return stream;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:Control.cs

示例10: GetPhysicalPath

 private static string GetPhysicalPath(VirtualPath virtualPath)
 {
     string physicalPath = null;
     try
     {
         physicalPath = virtualPath.MapPathInternal(true);
     }
     catch (HttpException exception)
     {
         if (exception.GetHttpCode() == 500)
         {
             throw new HttpException(0x194, string.Empty);
         }
         throw;
     }
     System.Web.Util.FileUtil.CheckSuspiciousPhysicalPath(physicalPath);
     return physicalPath;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:CachedPathData.cs


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