在不使用 httpcontext 的情况下获取应用程序路径.(asp.net) [英] Get application path without using httpcontext. (asp.net)

查看:24
本文介绍了在不使用 httpcontext 的情况下获取应用程序路径.(asp.net)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎么做?

我不想使用这个:

HttpContext.Current.Server.MapPath

是否有类似的函数可以在不需要 httpcontext 的情况下调用?

Is there a similar function that I can call without requiring a httpcontext?

例如,如果启动一个线程做一些事情,我不能使用 httpcontext,但我仍然需要获取应用程序的路径.不,我不能将上下文作为参数传递或从共享变量中读取它.

For example if a start a thread doing some stuff i cant use the httpcontext, but i still need to get the path of the app. And no i can't pass the context as an argument or read it from a shared var.

推荐答案

使用 HttpRuntime.AppDomainAppPath 属性.

Use the HttpRuntime.AppDomainAppPath property.

这篇关于在不使用 httpcontext 的情况下获取应用程序路径.(asp.net)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆