Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FileIOPermission Help

Reply
Thread Tools

FileIOPermission Help

 
 
Dave
Guest
Posts: n/a
 
      10-18-2008
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)
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      10-18-2008
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)

 
Reply With Quote
 
 
 
 
Dave
Guest
Posts: n/a
 
      10-19-2008
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 <(E-Mail Removed)> 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 -


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Permissions Error - FileIOPermission (aspx) and ImageFetch (ashx) Carl Gilbert ASP .Net 0 10-04-2006 09:43 PM
random FileIOPermission error Nalaka ASP .Net 8 08-17-2006 01:31 PM
FileIOPermission Erro using referenced dll on shared hosting brian@norman.org ASP .Net 4 05-31-2006 06:54 PM
Need Help Regarding System.Security.Permissions.FileIOPermission Usman Ghani ASP .Net Security 0 04-17-2006 02:03 PM
System.Security.Permissions.FileIOPermission =?Utf-8?B?cGF1bA==?= ASP .Net 0 10-01-2004 08:13 PM



Advertisments