本文整理汇总了C#中System.Web.VirtualPath.MapPath方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualPath.MapPath方法的具体用法?C# VirtualPath.MapPath怎么用?C# VirtualPath.MapPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.VirtualPath
的用法示例。
在下文中一共展示了VirtualPath.MapPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapPath
internal String MapPath(VirtualPath virtualPath) {
if (_wr != null) {
return MapPath(virtualPath, FilePathObject, true/*allowCrossAppMapping*/);
}
else {
return virtualPath.MapPath();
}
}
示例2: HttpRequest
internal HttpRequest(VirtualPath virtualPath, String queryString) {
_wr = null;
_pathTranslated = virtualPath.MapPath();
_httpMethod = "GET";
_url = new Uri("http://localhost" + virtualPath.VirtualPathString);
_path = virtualPath;
_queryStringText = queryString;
_queryStringOverriden = true;
_queryString = new HttpValueCollection(_queryStringText, true, true, Encoding.Default);
PerfCounters.IncrementCounter(AppPerfCounter.REQUESTS_EXECUTING);
}
示例3: IsUserAllowedToPath
internal static bool IsUserAllowedToPath(HttpContext context, VirtualPath virtualPath)
{
return IsUserAllowedToFile(context, virtualPath.MapPath());
}
示例4: MapPath
internal string MapPath(VirtualPath virtualPath)
{
if (this._wr != null)
{
return this.MapPath(virtualPath, this.FilePathObject, true);
}
return virtualPath.MapPath();
}
示例5: StartListeningToLocalResourcesDirectory
internal void StartListeningToLocalResourcesDirectory(VirtualPath virtualDir)
{
if (!this.IsFCNDisabled && ((this._callbackRenameOrCriticaldirChange != null) && (this._dirMonSpecialDirs != null)))
{
using (new ApplicationImpersonationContext())
{
this._lockDispose.AcquireReaderLock();
try
{
if (!this._disposed)
{
string path = FileUtil.RemoveTrailingDirectoryBackSlash(virtualDir.MapPath());
string fileName = Path.GetFileName(path);
path = Path.GetDirectoryName(path);
if (Directory.Exists(path))
{
this._dirMonSpecialDirs.Add(this.ListenToSubdirectoryChanges(path, fileName));
}
}
}
finally
{
this._lockDispose.ReleaseReaderLock();
}
}
}
}
示例6: GetCodeDirectoryAssembly
internal static Assembly GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, string assemblyName, StringSet excludedSubdirectories, bool isDirectoryAllowed)
{
string path = virtualDir.MapPath();
if (!isDirectoryAllowed && Directory.Exists(path))
{
throw new HttpException(System.Web.SR.GetString("Bar_dir_in_precompiled_app", new object[] { virtualDir }));
}
bool supportLocalization = IsResourceCodeDirectoryType(dirType);
string cacheKey = assemblyName;
BuildResult buildResultFromCache = BuildManager.GetBuildResultFromCache(cacheKey);
Assembly a = null;
if ((buildResultFromCache != null) && (buildResultFromCache is BuildResultCompiledAssembly))
{
if (buildResultFromCache is BuildResultMainCodeAssembly)
{
_mainCodeBuildResult = (BuildResultMainCodeAssembly) buildResultFromCache;
}
a = ((BuildResultCompiledAssembly) buildResultFromCache).ResultAssembly;
if (!supportLocalization)
{
return a;
}
if (!isDirectoryAllowed)
{
return a;
}
BuildResultResourceAssembly assembly2 = (BuildResultResourceAssembly) buildResultFromCache;
if (HashCodeCombiner.GetDirectoryHash(virtualDir) == assembly2.ResourcesDependenciesHash)
{
return a;
}
}
if (!isDirectoryAllowed)
{
return null;
}
if ((dirType != CodeDirectoryType.LocalResources) && !StringUtil.StringStartsWithIgnoreCase(path, HttpRuntime.AppDomainAppPathInternal))
{
throw new HttpException(System.Web.SR.GetString("Virtual_codedir", new object[] { virtualDir.VirtualPathString }));
}
if (!Directory.Exists(path))
{
if (dirType != CodeDirectoryType.MainCode)
{
return null;
}
if (!ProfileBuildProvider.HasCompilableProfile)
{
return null;
}
}
BuildManager.ReportDirectoryCompilationProgress(virtualDir);
DateTime utcNow = DateTime.UtcNow;
CodeDirectoryCompiler compiler = new CodeDirectoryCompiler(virtualDir, dirType, excludedSubdirectories);
string outputAssemblyName = null;
if (a != null)
{
outputAssemblyName = a.GetName().Name;
compiler._onlyBuildLocalizedResources = true;
}
else
{
outputAssemblyName = BuildManager.GenerateRandomAssemblyName(assemblyName);
}
BuildProvidersCompiler compiler2 = new BuildProvidersCompiler(virtualDir, supportLocalization, outputAssemblyName);
compiler._bpc = compiler2;
compiler.FindBuildProviders();
compiler2.SetBuildProviders(compiler._buildProviders);
CompilerResults results = compiler2.PerformBuild();
if (results != null)
{
DateTime time2 = DateTime.UtcNow.AddMilliseconds(3000.0);
do
{
if (UnsafeNativeMethods.GetModuleHandle(results.PathToAssembly) == IntPtr.Zero)
{
a = results.CompiledAssembly;
goto Label_01E6;
}
Thread.Sleep(250);
}
while (DateTime.UtcNow <= time2);
throw new HttpException(System.Web.SR.GetString("Assembly_already_loaded", new object[] { results.PathToAssembly }));
}
Label_01E6:
if (a == null)
{
return null;
}
if (dirType == CodeDirectoryType.MainCode)
{
_mainCodeBuildResult = new BuildResultMainCodeAssembly(a);
buildResultFromCache = _mainCodeBuildResult;
}
else if (supportLocalization)
{
buildResultFromCache = new BuildResultResourceAssembly(a);
}
else
{
//.........这里部分代码省略.........