如何以编程方式获取 ASP.NET 临时目录?
ASP.NET 使用的临时目录通常位于
C:\Windows\Microsoft.NET\Framework\<version>\Temporary ASP.NET Files\
“有时”下,但它会被 web.config 文件中的编译元素上的 tempDirectory 属性覆盖。
如何获取 ASP.NET 当前使用的临时目录,无论它是默认目录还是用户覆盖的目录?
PS 有一些属性将返回临时目录下的子目录(例如 AppDomain.CurrentDomain.DynamicDirectory 等),但我正在查找配置文件中显示的目录。
The temporary directory that's used by ASP.NET is usually located under
C:\Windows\Microsoft.NET\Framework\<version>\Temporary ASP.NET Files\
Sometimes however it is overridden by the tempDirectory attribute on the compilation element in the web.config file.
How can I get the temporary directory currently used by ASP.NET regardless if it's the default directory or a user overridden directory?
P.S. There are a few properties that will return a subdirectory under the temporary directory (e.g. AppDomain.CurrentDomain.DynamicDirectory
and others) but I'm looking for the directory as it appears in the configuration file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要静态属性
HttpRuntime.CodegenDir
You want the static property
HttpRuntime.CodegenDir