用于监视的文件名无效 [英] Invalid file name for monitoring
问题描述
我正在使用.Net编写一个简单的反向代理。
基本设计是捕获
$ b中的所有流量(来自所有URL的) $ b HttpHandler和相应的响应。
问题是我收到的URL包含`角色我
获得上面列出的例外;以及下面列出的调用堆栈。
问题;
1)我在哪里可以找到有关FileChangesMonitor类的更多文档?
2)是否有通过配置禁用缓存?
3)是否有某种方法挂钩HttpRuntime以覆盖此错误并继续处理?b / b $ br >
[HttpException(0x80070057):用于监控的文件名无效:
''C:\Inetpub \wwwroot \Proxy \〜''。用于监视的文件名必须具有绝对的
路径,并且没有通配符。]
System.Web.DirectoryMonitor.AddFileMonitor(String file)+429
System.Web.DirectoryMonitor.StartMonitoringFile(St ring文件,
FileChangeEventHandler回调,String别名)+76
System.Web.FileChangesMonitor.StartMonitoringPath(String alias,
FileChangeEventHandler回调)+495
System.Web.Caching.CacheDependency.Init(Boolean isPublic,Boolean
isSensitive,String [] filenamesArg,String [ ] cachekeysArg,CacheDependency
依赖,DateTime utcStart)+1535
System.Web.Caching.CacheDependency..ctor(Boolean isSensitive,String []
filenames,DateTime utcStart)+50
System.Web.Configuration.HttpConfigurationSystem.G etCacheDependencies(Hashtable cachedeps,DateTime utcStart)+151
系统。 Web.Configuration.HttpConfigurationSystem.C omposeConfig(String
reqPath,IHttpMap路径配置)+697
System.Web.HttpContext.GetCompleteConfigRecord(String reqpath,
IHttpMapPath configmap)+434
System.Web。 HttpContext.GetCompleteConfig()+49
System.Web.HttpContext.GetConfig(String name)+195
System.Web.CustomErrors.GetSettings(HttpContext context,Boolean
canThrow)+20
System.Web.HttpResponse.ReportRuntimeError(eex on e,Boolean canThrow)
+39
System.Web.HttpRuntime.FinishRequest(HttpWorkerReq uest wr,HttpContext
context,Exception e)+486
I am writing a simple reverse proxy using .Net.
The basic design is to capture all traffic (from all URL''s) in an
HttpHandler and the respond accordingly.
The problem is that I when a URL is received that contains a "`" character I
get the exception listed above; and the call stack listed below.
Questions;
1) Where can I find more documentation on the FileChangesMonitor class?
2) Is there anyway to disable the caching via a configuration?
3) Is there someway to hook the HttpRuntime to override this error and to
continue processing?
[HttpException (0x80070057): Invalid file name for monitoring:
''C:\Inetpub\wwwroot\Proxy\~''. File names for monitoring must have absolute
paths, and no wildcards.]
System.Web.DirectoryMonitor.AddFileMonitor(String file) +429
System.Web.DirectoryMonitor.StartMonitoringFile(St ring file,
FileChangeEventHandler callback, String alias) +76
System.Web.FileChangesMonitor.StartMonitoringPath( String alias,
FileChangeEventHandler callback) +495
System.Web.Caching.CacheDependency.Init(Boolean isPublic, Boolean
isSensitive, String[] filenamesArg, String[] cachekeysArg, CacheDependency
dependency, DateTime utcStart) +1535
System.Web.Caching.CacheDependency..ctor(Boolean isSensitive, String[]
filenames, DateTime utcStart) +50
System.Web.Configuration.HttpConfigurationSystem.G etCacheDependencies(Hashtable cachedeps, DateTime utcStart) +151
System.Web.Configuration.HttpConfigurationSystem.C omposeConfig(String
reqPath, IHttpMapPath configmap) +697
System.Web.HttpContext.GetCompleteConfigRecord(Str ing reqpath,
IHttpMapPath configmap) +434
System.Web.HttpContext.GetCompleteConfig() +49
System.Web.HttpContext.GetConfig(String name) +195
System.Web.CustomErrors.GetSettings(HttpContext context, Boolean
canThrow) +20
System.Web.HttpResponse.ReportRuntimeError(Excepti on e, Boolean canThrow)
+39
System.Web.HttpRuntime.FinishRequest(HttpWorkerReq uest wr, HttpContext
context, Exception e) +486
推荐答案
我找到了解决这个问题的方法。那就是你必须在下面包含以下代码:
Application_error事件
要包含的代码是
if(Request.Url.ToString()。IndexOf("〜")> 0)
{
Context.ClearError();
Context.RewritePath(" HttpError404.aspx");
返回;
}
HttpError404.aspx是你要重定向的页面。希望你知道。但这只能部分解决问题。当你给它时在文件名中你不会得到错误。但是当它在目录名称中给出时你可以。如果你有任何溶胶。到现在为止知道
rs*******@yahoo.com
是我的邮件ID
I duid find a way to solve this problem.That is you have to include the follwoing code in
Application_error event
the code to be included is
if (Request.Url.ToString().IndexOf("~") > 0)
{
Context.ClearError();
Context.RewritePath("HttpError404.aspx");
return;
}
HttpError404.aspx is the page u want to redirect.Hope u know that.But this only partially solves the problem.When u give it in the file name u wont get the error.But when it is given in the directory name u cant.If u have any sol. by now lemme know
rs*******@yahoo.com
is my mail id
我正在使用.Net编写一个简单的反向代理。
基本设计是在
HttpHandler中捕获所有流量(来自所有URL')并做出相应的响应。
问题在于,当收到包含的URL时,我角色我获得上面列出的例外情况;下面列出了调用堆栈。
问题;
1)我在哪里可以找到有关FileChangesMonitor类的更多文档?
2)无论如何通过配置禁用缓存?
3)是否有某种方法挂钩HttpRuntime以覆盖此错误并继续处理?
[HttpException(0x80070057):用于监控的文件名无效:
''C:\Inetpub \ www.root \Proxy \〜''。用于监视的文件名必须具有绝对路径,并且没有通配符。]
System.Web.DirectoryMonitor.AddFileMonitor(String file)+429
System.Web.DirectoryMonitor.StartMonitoringFile(St ring file ,FileChangeEventHandler回调,String别名)+76
System.Web.FileChangesMonitor.StartMonitoringPath(String别名,
FileChangeEventHandler回调)+495
System.Web.Caching.CacheDependency.Init (Boolean isPublic,Boolean
isSensitive,String [] filenamesArg,String [] cachekeysArg,CacheDependency
dependency,DateTime utcStart)+1535
System.Web.Caching.CacheDependency..ctor(Boolean isSensitive) ,String []
filenames,DateTime utcStart)+50
System.Web.Configuration.HttpConfigurationSystem.G etCacheDependencies(Hashtable cachedeps,DateTime utcStart)+151
System.Web。 Configuration.HttpConfigurationSystem.C omposeConfig(String
reqPath,IHttpMapPath configmap)+697
System.Web.HttpContext。 GetCompleteConfigRecord(String reqpath,
IHttpMapPath configmap)+434
System.Web.HttpContext.GetCompleteConfig()+49
System.Web.HttpContext.GetConfig(String name)+195
System.Web.CustomErrors.GetSettings(HttpContext context,Boolean
canThrow)+20
System.Web.HttpResponse.ReportRuntimeError(eex on e,Boolean canThrow)
System.Web.HttpRuntime.FinishRequest(HttpWorkerReq uest wr,HttpContext
context,Exception e)+486
I am writing a simple reverse proxy using .Net.
The basic design is to capture all traffic (from all URL''s) in an
HttpHandler and the respond accordingly.
The problem is that I when a URL is received that contains a "`" character I
get the exception listed above; and the call stack listed below.
Questions;
1) Where can I find more documentation on the FileChangesMonitor class?
2) Is there anyway to disable the caching via a configuration?
3) Is there someway to hook the HttpRuntime to override this error and to
continue processing?
[HttpException (0x80070057): Invalid file name for monitoring:
''C:\Inetpub\wwwroot\Proxy\~''. File names for monitoring must have absolute
paths, and no wildcards.]
System.Web.DirectoryMonitor.AddFileMonitor(String file) +429
System.Web.DirectoryMonitor.StartMonitoringFile(St ring file,
FileChangeEventHandler callback, String alias) +76
System.Web.FileChangesMonitor.StartMonitoringPath( String alias,
FileChangeEventHandler callback) +495
System.Web.Caching.CacheDependency.Init(Boolean isPublic, Boolean
isSensitive, String[] filenamesArg, String[] cachekeysArg, CacheDependency
dependency, DateTime utcStart) +1535
System.Web.Caching.CacheDependency..ctor(Boolean isSensitive, String[]
filenames, DateTime utcStart) +50
System.Web.Configuration.HttpConfigurationSystem.G etCacheDependencies(Hashtable cachedeps, DateTime utcStart) +151
System.Web.Configuration.HttpConfigurationSystem.C omposeConfig(String
reqPath, IHttpMapPath configmap) +697
System.Web.HttpContext.GetCompleteConfigRecord(Str ing reqpath,
IHttpMapPath configmap) +434
System.Web.HttpContext.GetCompleteConfig() +49
System.Web.HttpContext.GetConfig(String name) +195
System.Web.CustomErrors.GetSettings(HttpContext context, Boolean
canThrow) +20
System.Web.HttpResponse.ReportRuntimeError(Excepti on e, Boolean canThrow)
+39
System.Web.HttpRuntime.FinishRequest(HttpWorkerReq uest wr, HttpContext
context, Exception e) +486
用户提交自AEWNET(< a rel =nofollowhref =http://www.aewnet.com/target =_ blank> http://www.aewnet.com/ )
这篇关于用于监视的文件名无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!