简体   繁体   中英

ASP.Net web application cannot read a file within folder

In my asp.net web application, I read the xml file for obtaining a key. If file is not present I show a form to enter the key details and then create the file.

First problem : My app does not recognize the file even if its there.

Second problem : I am running application on the server. When writing, rather overwriting the file, browser shows the username, password prompt before writing the file. If I enter admin credentials it allows to create a file.

I have checked all possible combinations of permissions on the file / folders, but could not resolve the problem.

Any ideas, what I could be missing here?

You read the xml file but is it as a part of your solution? If yes, are you reading it through relative path ie are you using Server.MapPath to read it like Server.MapPath("~/Files.test.xml")? Once you use relative path, I don't think it will ask you credentials as it still is in your project directory.

It should work. I am also reading and writing files in my web application.

If it still does not work, please tell me the way you are reading file.

Thanks,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM