could not find xml file -- urgent
-
My appliction is Online Test and i am getting an issue in the same. I have summarized the issue below. If you have any solution or if you know what causes that then Please let me know. Issue: ===== When a candidate starts test I am creating an xml file in page say starttest.aspx in the server its size may vary (maximum size is 60kb). After that I am opening a pop up window say test.aspx and reading the data from xml file displaying the questions and answers. When I read the xml file I am getting the following error “System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.IO.FileNotFoundException: Could not find file "C:\sahitya.kothuri_7000.xml". File name: "C:\sahitya.kothuri_7000.xml" at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) at System.IO.StreamReader..ctor(String path) at SkillExaminer.Candidate.CandidateTestXml.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\skillexaminer\candidate\candidatetestxml.aspx.cs:line 120” I am not getting the error when two people take up test. But when 40 people take test one or two are getting this for rest of them it works fine. Can you guess what could have caused this problem?
Ramya
-
My appliction is Online Test and i am getting an issue in the same. I have summarized the issue below. If you have any solution or if you know what causes that then Please let me know. Issue: ===== When a candidate starts test I am creating an xml file in page say starttest.aspx in the server its size may vary (maximum size is 60kb). After that I am opening a pop up window say test.aspx and reading the data from xml file displaying the questions and answers. When I read the xml file I am getting the following error “System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.IO.FileNotFoundException: Could not find file "C:\sahitya.kothuri_7000.xml". File name: "C:\sahitya.kothuri_7000.xml" at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) at System.IO.StreamReader..ctor(String path) at SkillExaminer.Candidate.CandidateTestXml.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\skillexaminer\candidate\candidatetestxml.aspx.cs:line 120” I am not getting the error when two people take up test. But when 40 people take test one or two are getting this for rest of them it works fine. Can you guess what could have caused this problem?
Ramya
This is because the system is not able to find the file. and the reason could be youare trying to access the file before it is created. Thus the application works when your file is present and otherwise throws an exception. Fastest way (not the best) to slove ths is Handle the exception, you can do that by putting code (where you try to open the file) in a try catch block, and ask te usr to retry. I hope that helps. Regards,