FileIOPermission Help

Discussion in 'ASP .Net' started by Dave, Oct 18, 2008.

  1. Dave

    Dave Guest

    Yesterday I posted:

    ****************************
    I'm trying to download a file from the Web Server to the user's
    desktop using myWebClient.DownloadFile 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:
    "FileIOPermission to write the file fileName. Associated enumeration:
    Write."

    Since I'm not sure how to apply the FileIOPermission 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 =
    FileListGridView.SelectedValue.ToString(), myStringWebResource = null;
    WebClient myWebClient = new WebClient();
    myStringWebResource = remoteUri + fileName;
    myWebClient.DownloadFile(myStringWebResource, fileName);

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


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

    (Please no Advertisements for something to buy)
     
    Dave, Oct 18, 2008
    #1
    1. Advertisements

  2. Dave

    bruce barker Guest

    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.DownloadFile 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:
    > "FileIOPermission to write the file fileName. Associated enumeration:
    > Write."
    >
    > Since I'm not sure how to apply the FileIOPermission 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 =
    > FileListGridView.SelectedValue.ToString(), myStringWebResource = null;
    > WebClient myWebClient = new WebClient();
    > myStringWebResource = remoteUri + fileName;
    > myWebClient.DownloadFile(myStringWebResource, fileName);
    >
    > }
    > catch (Exception ex)
    > {
    > lblStatus.Text = ex.Message;
    > }
    >
    >
    > ****************************
    > Thanks
    >
    > (Please no Advertisements for something to buy)
     
    bruce barker, Oct 18, 2008
    #2
    1. Advertisements

  3. Dave

    Dave Guest

    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 <> wrote:
    > 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.DownloadFile 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:
    > > "FileIOPermission to write the file fileName. Associated enumeration:
    > > Write."

    >
    > > Since I'm not sure how to apply the FileIOPermission 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 =
    > > FileListGridView.SelectedValue.ToString(), myStringWebResource = null;
    > >             WebClient myWebClient = new WebClient();
    > >             myStringWebResource = remoteUri + fileName;
    > >             myWebClient.DownloadFile(myStringWebResource, fileName);

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

    >
    > > ****************************
    > > Thanks

    >
    > > (Please no Advertisements for something to buy)- Hide quoted text -

    >
    > - Show quoted text -
     
    Dave, Oct 19, 2008
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cGF1bA==?=

    System.Security.Permissions.FileIOPermission

    =?Utf-8?B?cGF1bA==?=, Oct 1, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,139
    =?Utf-8?B?cGF1bA==?=
    Oct 1, 2004
  2. Replies:
    4
    Views:
    21,243
    Nicole Calinoiu
    May 31, 2006
  3. Nalaka

    random FileIOPermission error

    Nalaka, Aug 1, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    662
    Walter Wang [MSFT]
    Aug 17, 2006
  4. Carl Gilbert
    Replies:
    0
    Views:
    626
    Carl Gilbert
    Oct 4, 2006
  5. Eric Phetteplace

    System.Security.Permissions.FileIOPermission

    Eric Phetteplace, Jun 11, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    297
    Eric Phetteplace
    Jun 12, 2004
  6. richard

    FolderBrowserDialog and FileIOPermission

    richard, Dec 5, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    298
    richard
    Dec 5, 2004
  7. Simon Cheng

    System.Security.Permissions.FileIOPermission

    Simon Cheng, Nov 25, 2005, in forum: ASP .Net Security
    Replies:
    3
    Views:
    470
    Dominick Baier [DevelopMentor]
    Nov 25, 2005
  8. Usman Ghani
    Replies:
    0
    Views:
    251
    Usman Ghani
    Apr 17, 2006
Loading...