OpenFileDialog in Web...
-
Hi Friends, I dont know in which section should I post this question coz it related to both C# and ASP.NET. I have very strange requirment. I our project we developed our application in windows forms project. The project contains a bunch of class libraries and number of windows usercontrol libraries. Now we are hosting those user controls to the web. Everything is working fine till the control with FileOpenDialog in it comes in picture. When that user control opens in web it throws the followin exception. "Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission contact your system administrator, or use the microsoft .net frameword configuration tool. Request for permission type 'system.security.permissions.fileiopermission, mscorlib, version=2.0.0.0, Cultrue=neutral, pulickeytoken=xxxsdlff' failed." I know the reason why this exception is coming. what I want to know is , is there any work aroud of this problem except using asp.net "file" control? Thank you all in advance. Thanks and regards, Chetan Ranpariya
Thanks and Regards, Chetan Ranpariya
-
Hi Friends, I dont know in which section should I post this question coz it related to both C# and ASP.NET. I have very strange requirment. I our project we developed our application in windows forms project. The project contains a bunch of class libraries and number of windows usercontrol libraries. Now we are hosting those user controls to the web. Everything is working fine till the control with FileOpenDialog in it comes in picture. When that user control opens in web it throws the followin exception. "Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission contact your system administrator, or use the microsoft .net frameword configuration tool. Request for permission type 'system.security.permissions.fileiopermission, mscorlib, version=2.0.0.0, Cultrue=neutral, pulickeytoken=xxxsdlff' failed." I know the reason why this exception is coming. what I want to know is , is there any work aroud of this problem except using asp.net "file" control? Thank you all in advance. Thanks and regards, Chetan Ranpariya
Thanks and Regards, Chetan Ranpariya
-
Hi Friends, I dont know in which section should I post this question coz it related to both C# and ASP.NET. I have very strange requirment. I our project we developed our application in windows forms project. The project contains a bunch of class libraries and number of windows usercontrol libraries. Now we are hosting those user controls to the web. Everything is working fine till the control with FileOpenDialog in it comes in picture. When that user control opens in web it throws the followin exception. "Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission contact your system administrator, or use the microsoft .net frameword configuration tool. Request for permission type 'system.security.permissions.fileiopermission, mscorlib, version=2.0.0.0, Cultrue=neutral, pulickeytoken=xxxsdlff' failed." I know the reason why this exception is coming. what I want to know is , is there any work aroud of this problem except using asp.net "file" control? Thank you all in advance. Thanks and regards, Chetan Ranpariya
Thanks and Regards, Chetan Ranpariya
Do you mean that you're using Windows Forms controls in a webpage, where the control is downloaded to the browser? Those controls run in a security sandbox, to prevent them from damaging the rest of the system (this is the same as Java applets). The CLR enforces this security sandbox by preventing code from being loaded that would violate the security policy. One of the things that remote code is not allowed to do is open arbitrary files directly using the
FileStream
class or its derivatives. You can generally, however, open files via an
OpenFileDialog
, if you use the
OpenFile
method of the dialog object. You cannot find out the filename using the
FileName
property. The .NET Framework security set is quite granular. The exact permissions to perform a task are generally listed at the bottom of the documentation. You can find the list of defaults at Default Security Policy[^]. Your code, if running in a web page, will come under the Local Intranet zone if on the local network (and, in IE 7.0, the computer is on an Active Directory domain) and under Internet if on a different network.
DoEvents: Generating unexpected recursion since 1991