473,796 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileIOPermissio n 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)
Oct 18 '08 #1
2 1414
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)
Oct 18 '08 #2
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 -
Oct 19 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1375
by: Mircea Pleteriu | last post by:
Hi all, I have this code sample FileIOPermission fp = new FileIOPermission(PermissionState.Unrestricted); fp.Deny(); StreamWriter sw = new StreamWriter(@"c:\test.txt");
0
3855
by: Ant Corrie | last post by:
I am at a loss as to why this is not working. I am trying to setup a TextWriterTraceListener in my application config file and then execute the app from the network. I get a security exception (listed below) even though I have StrongNamed my application and used the .NET Configuration Tool to create a Code Access Group in the Machine Policy that gives FullTrust to assemblies with the StrongName that I created. If you uncomment the code...
0
1732
by: paul | last post by:
I just installed Windows XP SP2 on my web server. Now when I run one of the web applications I get the following error: ArgumentException: Illegal characters in path.] System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String str) +276 System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, String pathListOrig, Boolean checkForDuplicates, Boolean
0
1133
by: John Delange | last post by:
Hello, I wrote a .NET Windows.Forms User Control that needs to be runned through Internet Explorer, like in this article: http://www.15seconds.com/issue/030610.htm. This control needs to 1.) Run on the Internet and 2.) have FileIOPermission... Is there a way of deployment where the final user (the user who's just surfing on the internet) doesn't have to set the FileIOPermission to the assembly manually? Like the way signed ActiveX...
1
6879
by: Usman Ghani | last post by:
Hi, I am trying to develop an activex control with the .Net by exposing an interface to the com as described in the following article. http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx?ArticleID=99d9681d-84de-4d64-9c85-9ae9c15a4ee7. This works fine for the simple control which is mentioned in the article.Now I have to read some files on the client machine through this activex.When I tried to...
6
2477
by: schaf | last post by:
Hi NG ! I have the following piece of code below. the first try/catch part would return true although I do not have permission to access this computer. The second try/catch part would return false. Do I misunderstand the meaning of FileIOPermission ? >From MSDN: "Controls the ability to access files and folders" ??? Thanks for education! Regards Marcel (Schaf)
1
2187
by: Marquis | last post by:
I have put the C# Form onito the Internet as an ActiveX Control. However, I cannot do the FileOpen Dialog as I don't have permission, how to solve this problem? Below is the error code: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at...
3
12062
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. (machine.config) ---> System.Security.SecurityException: Request for the permission of type
1
2797
by: innes | last post by:
Hi, I'm trying to test permission to access the file system, using FileIOPermission, but can't seem to get it to work. See my sample app below, for an app that tries to demand a permission to read a specified path, and then calls Directory.GetFiles on that path. The Demands on FileIOPermissions (I tried 3 variations) all work, and then when I call Directory.GetFiles an exception is thrown... saying
0
9527
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.