Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. File not found Exception [how to solve this]

File not found Exception [how to solve this]

Scheduled Pinned Locked Moved C#
visual-studiosecurityhelptutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ridda786
    wrote on last edited by
    #1

    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

    K S L 3 Replies Last reply
    0
    • R ridda786

      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

      K Offline
      K Offline
      kkun
      wrote on last edited by
      #2

      It said Could not find file 'C:\WINDOWS\system32\VS_logo.PNG':) I think your visual studio or system was demaged ,

      1 Reply Last reply
      0
      • R ridda786

        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

        S Offline
        S Offline
        ScottM1
        wrote on last edited by
        #3

        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.

        R 1 Reply Last reply
        0
        • R ridda786

          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

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          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!

          **

          R 1 Reply Last reply
          0
          • S ScottM1

            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.

            R Offline
            R Offline
            ridda786
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • L leppie

              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!

              **

              R Offline
              R Offline
              ridda786
              wrote on last edited by
              #6

              Hi Leppi ur link not working at my side, this page is not opened.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups