File not found Exception [how to solve this]
-
Hello everyone, im using VS2005, i have a webpage in which i have a FileUpload control, and a Submit button. On the Submit button (.cs)page, i call this line : FileStream FilStr = new FileStream(FileUpload1.FileName, FileMode.Open); but at run time whenever i select a file and then click on submit button, it gives me the following exception at the above line of code: System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\system32\VS_logo.PNG'. File name: 'C:\WINDOWS\system32\VS_logo.PNG' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at Reports_DynamicImage.btnSubmit_Click(Object sender, EventArgs e) in d:\Projects\RubberDuck\Code\CrystalReportsSolution\CrystalReportsWeb\Reports\DynamicImage.aspx.cs:line 42 plz tell me whats wrong with this, and y its looking the image in the C:|windows as the image is in the Mypictures foders of the My Documents. I includede the using System.IO namespace also but this exception still comes. help me its urgent reply me asap. Thanx in Advance. rida
-
Hello everyone, im using VS2005, i have a webpage in which i have a FileUpload control, and a Submit button. On the Submit button (.cs)page, i call this line : FileStream FilStr = new FileStream(FileUpload1.FileName, FileMode.Open); but at run time whenever i select a file and then click on submit button, it gives me the following exception at the above line of code: System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\system32\VS_logo.PNG'. File name: 'C:\WINDOWS\system32\VS_logo.PNG' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at Reports_DynamicImage.btnSubmit_Click(Object sender, EventArgs e) in d:\Projects\RubberDuck\Code\CrystalReportsSolution\CrystalReportsWeb\Reports\DynamicImage.aspx.cs:line 42 plz tell me whats wrong with this, and y its looking the image in the C:|windows as the image is in the Mypictures foders of the My Documents. I includede the using System.IO namespace also but this exception still comes. help me its urgent reply me asap. Thanx in Advance. rida
-
Hello everyone, im using VS2005, i have a webpage in which i have a FileUpload control, and a Submit button. On the Submit button (.cs)page, i call this line : FileStream FilStr = new FileStream(FileUpload1.FileName, FileMode.Open); but at run time whenever i select a file and then click on submit button, it gives me the following exception at the above line of code: System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\system32\VS_logo.PNG'. File name: 'C:\WINDOWS\system32\VS_logo.PNG' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at Reports_DynamicImage.btnSubmit_Click(Object sender, EventArgs e) in d:\Projects\RubberDuck\Code\CrystalReportsSolution\CrystalReportsWeb\Reports\DynamicImage.aspx.cs:line 42 plz tell me whats wrong with this, and y its looking the image in the C:|windows as the image is in the Mypictures foders of the My Documents. I includede the using System.IO namespace also but this exception still comes. help me its urgent reply me asap. Thanx in Advance. rida
I have VS2005 and that image doesn't exist on my system either. How are you getting the path to the image, allowing the user to browse? Perhaps try and hardcode the path and let me know what happens.
There are 10 types of people in the world, those who understand binary and those who dont.
-
Hello everyone, im using VS2005, i have a webpage in which i have a FileUpload control, and a Submit button. On the Submit button (.cs)page, i call this line : FileStream FilStr = new FileStream(FileUpload1.FileName, FileMode.Open); but at run time whenever i select a file and then click on submit button, it gives me the following exception at the above line of code: System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\system32\VS_logo.PNG'. File name: 'C:\WINDOWS\system32\VS_logo.PNG' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at Reports_DynamicImage.btnSubmit_Click(Object sender, EventArgs e) in d:\Projects\RubberDuck\Code\CrystalReportsSolution\CrystalReportsWeb\Reports\DynamicImage.aspx.cs:line 42 plz tell me whats wrong with this, and y its looking the image in the C:|windows as the image is in the Mypictures foders of the My Documents. I includede the using System.IO namespace also but this exception still comes. help me its urgent reply me asap. Thanx in Advance. rida
-
I have VS2005 and that image doesn't exist on my system either. How are you getting the path to the image, allowing the user to browse? Perhaps try and hardcode the path and let me know what happens.
There are 10 types of people in the world, those who understand binary and those who dont.
yes u right, i have a Fileupload control, in this a text box and Browse filed exists, user clicks on the browse button and the path is set into the text box, so that y me using that line of code :: //string fname = FileUpload1.FileName; //Response.Write(fname); //get the image file into a stream reader. FileStream FilStr = new FileStream(FileUpload1.FileName, FileMode.Open); BinaryReader BinRed = new BinaryReader(FilStr); as u see the comments stmt codes when i used this one, or hardcode the path in the FileStream line , it gives me the same error, plz help me how can i get rid from this. Thanx in Advance.
-
ASP.NET's working directory is C:\WINDOWS\system32\, and besides, you cant use the client path on the server, thats just absurd!
**
xacc.ide-0.2.0.74 - now with C# 3.5 support!
**