Why AppDomain.CurrentDomain.BaseDirectory not contains “bin” in asp.net app?

后端 未结 4 791
天命终不由人
天命终不由人 2020-11-28 11:58

I have a web project like:

namespace Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, Event         


        
4条回答
  •  悲哀的现实
    2020-11-28 12:42

    When ASP.net builds your site it outputs build assemblies in its special place for them. So getting path in that way is strange.

    For asp.net hosted applications you can use:

    string path = HttpContext.Current.Server.MapPath("~/App_Data/somedata.xml");
    

提交回复
热议问题