ASP.NET MVC Website Read File from Disk Problem

后端 未结 3 1947
眼角桃花
眼角桃花 2021-01-06 06:31

I\'m reading a text file containing an insert statement for SQL using C# in an MVC Website I\'m working on. When debugging the function I\'m using works fine and the insert

3条回答
  •  盖世英雄少女心
    2021-01-06 06:56

    Workaround:

    Instead of using

    Server.MapPath("\\temp\\"...
    

    Create folder under root with name "temp" and use

    System.Web.HttpContext.Current.Request.MapPath("~\\temp....
    

提交回复
热议问题