File Access Denied in PDA(IE Mobile Ver. 5)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jeywin Lizy
    New Member
    • Dec 2008
    • 4

    File Access Denied in PDA(IE Mobile Ver. 5)

    My web application need to get file size and file contents of the file the user will be selecting.

    It was throwing error on
    FileInfo fileInfo = new FileInfo(pathSo urce);
    return fileInfo.Length .ToString();

    I thought it was due to CAS
    and so included
    assembly:Permis sionSetAttribut e(SecurityActio n.RequestMinimu m, Name = "FullTrust" )]

    It started working fine in my system,even with remote access to the appln.

    But it throws an error if the application is accessed via PDA(with IE mobile ver 5) when the user selects a file say 'Test.txt' available in the user's PDA.
    Throws an error 'Cannot find the file \...filepath... \Test.txt

    Pls let me know the possible way to enable my application to get the details of the file the user may select from the user's harddisk(PDA in this case)

    Or should I change any security setting in PDA?
    Or is there a way allow this permission thro' ASP.Net code?

    Thanks in advance.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Your FileInfo code ONLY runs on the server of the web application.
    Unless you have installed the application onto the PDA, it should always fail because the files are on the PDA not the server

    Comment

    • Jeywin Lizy
      New Member
      • Dec 2008
      • 4

      #3
      Hi Plater
      Please let me know how then to access the files (read file content) in PDA.
      I have removed the FileInfo.The code below


      //returns the stream of the filefor which path passed
      Stream a = ReadStream(txtF ilePath.Text);
      Label1.Text = a.Length.ToStri ng();

      works fine in my system.
      But it throws an error if the application is accessed via PDA(with IE mobile ver 5) when the user selects a file say 'Test.txt' available in the user's PDA.

      Throws an error
      System.IO.Direc toryNotFoundExc eption:could not find a part of the path 'c:\SD-MMCard\Test.txt '

      The file selected from PDA is \SD-MMCard\Test.txt
      But it gives a message as tho' it is located in C drive.
      Pls let me know how to read the file the user may select from the user's harddisk(PDA in this case)
      (FileUpload is not supported in IE mobile ver 5.0 - which is my actual requirement/task)

      Do I need to change some setting in PDA?
      Or can this be trapped in ASP.Net code itself?

      I have also tried giving:
      <trust level="Full" />

      Pls help me.

      Thanks
      Lizy

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Your users will have to upload the file to you.
        The FilUpload control might be a good control to look at for this task.

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Yes, can you imagine the security risk if servers were able to remotely browse client's file systems?

          Comment

          • Jeywin Lizy
            New Member
            • Dec 2008
            • 4

            #6
            I have tried using <asp:FileUpload ... and <input type=file ...
            But this works only in IE.
            The PDA with IE Mobile version 5.0 does not support this.
            I am able upload only XML or zip file. Otherwise
            the HTTPFileCollect ion does not contain any file after browsing & selecting files
            and it throws an error when trying to retrieve from PostedFile.


            I debuggeg and found
            Request.Browser .Capabilities["supportsFileUp load"] returns False (for IE 6 it returns True)

            Request.AcceptT ypes returns only */* --> wheras IE 6 returns many others(jpeg,gif f,bmp...xls...) along with this

            It there is a way around for this please let me know asap.

            Thanks

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              Unless there is some setting in ie5 that you can change to allow support for it, no I don't think there is. At least not a web based solution.
              You might be able to write a regular app that uses socket calls, but that seems like it would be more likely to be blocked on that pda

              Comment

              • Jeywin Lizy
                New Member
                • Dec 2008
                • 4

                #8
                FileUpload in PDA -workaround

                Thanks for your replies. After trying regarding FileUpload control I thought the work around to upload file in PDA will be like reading the files the user selects and saving it in database
                But this gives message as I have said in my prev post
                'System.IO.Dire ctoryNotFoundEx ception:could not find a part of the path'
                (but works fine in PC).Please let me know how I can trap this error .Otherwise said How can I accomplish this task of reading files in PDA.Please help me.

                Please let me know if I can move in this direction

                or is it that its not the correct way of proceeding as InsertAlias has pointed out about security risk if servers were able to remotely browse client's file systems

                or any other workaround that can be done to accomplish this.

                Your solution & suggestion will be really of much much help.
                Thanks in advance.

                Comment

                • Plater
                  Recognized Expert Expert
                  • Apr 2007
                  • 7872

                  #9
                  AGAIN....your backend code ONLY RUNS ON THE SERVER, it does not run on the client.
                  If the FileUpload is blocked by the PDA, and you must have file uploads.
                  It might be time for a new pda, or time to upgrade the software on it.

                  Comment

                  Working...