FileIOPermission Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    #1

    FileIOPermission Help

    Yesterday I posted:

    *************** *************
    I'm trying to download a file from the Web Server to the user's
    desktop using myWebClient.Dow nloadFile as described by Microsoft at
    http://msdn.microsoft.com/en-us/library/ez801hhe.aspx.

    2 Questions:


    1.) Is this the best approach?
    2.) Is there a way to have the default download location as the
    User's Desktop?

    *************** *************

    One thing that I just noticed at the bottom of the MSDN article, and
    could explain why it's not working, is:
    "FileIOPermissi on to write the file fileName. Associated enumeration:
    Write."

    Since I'm not sure how to apply the FileIOPermissio n example, and the
    Write link doesn't work in English...Can someone give me a hand on how
    apply this?

    My code is:

    try
    {
    string remoteUri = @"http://JCPS/TechVault/Vault/";
    string fileName =
    FileListGridVie w.SelectedValue .ToString(), myStringWebReso urce = null;
    WebClient myWebClient = new WebClient();
    myStringWebReso urce = remoteUri + fileName;
    myWebClient.Dow nloadFile(myStr ingWebResource, fileName);

    }
    catch (Exception ex)
    {
    lblStatus.Text = ex.Message;
    }


    *************** *************
    Thanks

    (Please no Advertisements for something to buy)
  • bruce barker

    #2
    Re: FileIOPermissio n Help

    remember the download is happening on the server, so the path you
    specify must be accessible from server, and access granted to the app
    pool account. generally this account is pretty locked down, and by
    default is a local machine account with no network permissions.

    -- bruce (sqlwork.com)

    Dave wrote:
    Yesterday I posted:
    >
    *************** *************
    I'm trying to download a file from the Web Server to the user's
    desktop using myWebClient.Dow nloadFile as described by Microsoft at
    http://msdn.microsoft.com/en-us/library/ez801hhe.aspx.
    >
    2 Questions:
    >
    >
    1.) Is this the best approach?
    2.) Is there a way to have the default download location as the
    User's Desktop?
    >
    *************** *************
    >
    One thing that I just noticed at the bottom of the MSDN article, and
    could explain why it's not working, is:
    "FileIOPermissi on to write the file fileName. Associated enumeration:
    Write."
    >
    Since I'm not sure how to apply the FileIOPermissio n example, and the
    Write link doesn't work in English...Can someone give me a hand on how
    apply this?
    >
    My code is:
    >
    try
    {
    string remoteUri = @"http://JCPS/TechVault/Vault/";
    string fileName =
    FileListGridVie w.SelectedValue .ToString(), myStringWebReso urce = null;
    WebClient myWebClient = new WebClient();
    myStringWebReso urce = remoteUri + fileName;
    myWebClient.Dow nloadFile(myStr ingWebResource, fileName);
    >
    }
    catch (Exception ex)
    {
    lblStatus.Text = ex.Message;
    }
    >
    >
    *************** *************
    Thanks
    >
    (Please no Advertisements for something to buy)

    Comment

    • Dave

      #3
      Re: FileIOPermissio n Help

      I don't have any problem with making the environments as secure as
      possible. Is there a way to prompt the user to whether or not they
      want to Open or Save the file? It would seem to me that that would
      satisfy the whole problem.



      On Oct 18, 3:53 pm, bruce barker <nos...@nospam. comwrote:
      remember the download is happening on the server, so the path you
      specify must be accessible from server, and access granted to the app
      pool account. generally this account is pretty locked down, and by
      default is a local machine account with no network permissions.
      >
      -- bruce (sqlwork.com)
      >
      >
      >
      Dave wrote:
      Yesterday I posted:
      >
      *************** *************
      I'm trying to download a file from the Web Server to the user's
      desktop using myWebClient.Dow nloadFile as described by Microsoft at
      http://msdn.microsoft.com/en-us/library/ez801hhe.aspx.
      >
      2 Questions:
      >
      1.)  Is this the best approach?
      2.)  Is there a way to have the default download location as the
      User's Desktop?
      >
      *************** *************
      >
      One thing that I just noticed at the bottom of the MSDN article, and
      could explain why it's not working, is:
      "FileIOPermissi on to write the file fileName. Associated enumeration:
      Write."
      >
      Since I'm not sure how to apply the FileIOPermissio n example, and the
      Write link doesn't work in English...Can someone give me a hand on how
      apply this?
      >
      My code is:
      >
              try
              {
                  string remoteUri = @"http://JCPS/TechVault/Vault/";
                  string fileName =
      FileListGridVie w.SelectedValue .ToString(), myStringWebReso urce = null;
                  WebClient myWebClient = new WebClient();
                  myStringWebReso urce = remoteUri + fileName;
                  myWebClient.Dow nloadFile(myStr ingWebResource, fileName);
      >
              }
              catch (Exception ex)
              {
                  lblStatus.Text = ex.Message;
              }
      >
      *************** *************
      Thanks
      >
      (Please no Advertisements for something to buy)- Hide quoted text -
      >
      - Show quoted text -

      Comment

      Working...