System.Security.SecurityException. Plzz Help

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
11/1/2007 8:13:44 AM
Gravatar
Total Posts 17

System.Security.SecurityException. Plzz Help

Hey Joe!

I am getting the following error message..

plzz get back to me soon.

 

Thank you.

 

Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.Web.HttpContext.System.IServiceProvider.GetService(Type service) +54
Brettle.Web.NeatUpload.UploadHttpModule.GetCurrentWorkerRequest() +57
Brettle.Web.NeatUpload.UploadHttpModule.Application_BeginRequest(Object sender, EventArgs e) +72
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

 

11/1/2007 8:29:02 AM
Gravatar
Total Posts 18409

Re: System.Security.SecurityException. Plzz Help

Hi Kunjan,

See this documentation:

http://www.mojoportal.com/mediumtrust.aspx

Hope it helps,

Joe

11/2/2007 12:48:53 AM
Gravatar
Total Posts 17

Re: System.Security.SecurityException. Plzz Help

The content that belongs here is too complex to display securely.
11/2/2007 4:45:20 AM
Gravatar
Total Posts 17

Re: System.Security.SecurityException. Plzz Help

Hey! Joe

I solved tht above error.

And i also made web.config changes for medium trust, But still getting the error Message of Security Exception. see below.

 

Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) +0
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +172
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114
System.Activator.CreateInstance(Type type, Object[] args) +16
System.Resources.ResourceManager.CreateResourceSet(Stream store, Assembly assembly) +549
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +1161
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +681
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +681
System.Resources.ResourceManager.GetString(String name, CultureInfo culture) +77
System.Resources.ResourceManager.GetString(String name) +6
Brettle.Web.NeatUpload.Config..ctor() +274
Brettle.Web.NeatUpload.Config.CreateFromConfigSection(Config parent, XmlNode section) +83
Brettle.Web.NeatUpload.ConfigSectionHandler.Create(Object parent, Object context, XmlNode section) +21
System.Configuration.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) +251
System.Configuration.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) +93
System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) +82
System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line) +64


Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

11/2/2007 7:37:08 AM
Gravatar
Total Posts 18409

Re: System.Security.SecurityException. Plzz Help

I don't think you have commented out all the references to NeatUpload from Web.connfig

Joe

11/2/2007 8:25:46 AM
Gravatar
Total Posts 17

Re: System.Security.SecurityException. Plzz Help

The content that belongs here is too complex to display securely.
11/2/2007 8:39:11 AM
Gravatar
Total Posts 18409

Re: System.Security.SecurityException. Plzz Help

No, you misunderstood the instructions. You should be commenting it out not uncommenting it. Remove all references by commenting it out.

The only part of the instructions about medium trust that says uncomment anything about NeatUpload is "if it is installed in the GAC by the host".

In your case it is not in the GAC and you are runniing in medium trust so you can't use NeatUpload at all.

Comment out  all references to NeatUplaod in web.config.

Joe

11/2/2007 9:28:49 AM
Gravatar
Total Posts 17

Re: System.Security.SecurityException. Plzz Help

Thanks alott! Joe

That Neatupload error is Solved.

But now this screen of errors comes. May be i think its Mysql problem. I have checked all connectionstrings, tht r ok. Database is also Ok.

 

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) +0
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +172
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114
System.Activator.CreateInstance(Type type, Object[] args) +16
System.Resources.ResourceManager.CreateResourceSet(Stream store, Assembly assembly) +549
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +1161
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +681
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) +681
System.Resources.ResourceManager.GetString(String name, CultureInfo culture) +77
MySql.Data.MySqlClient.Resources.get_UnableToConnectToHost() +24
MySql.Data.MySqlClient.NativeDriver.Open() +248
MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +50
MySql.Data.MySqlClient.MySqlPool.GetConnection() +142
MySql.Data.MySqlClient.MySqlConnection.Open() +209
MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(String connectionString, String commandText, MySqlParameter[] commandParameters) +59
mojoPortal.Data.dbPortal.SiteFolder_Exists(String folderName) +205
mojoPortal.Business.SiteFolder.Exists(String folderName) +5
mojoPortal.Business.WebHelpers.VirtualFolderEvaluator.VirtualFolderName() +531
mojoPortal.Web.UrlRewriter.RewriteUrl(HttpApplication app) +83
mojoPortal.Web.UrlRewriter.UrlRewriter_BeginRequest(Object sender, EventArgs e) +368
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

11/2/2007 10:18:41 AM
Gravatar
Total Posts 18409

Re: System.Security.SecurityException. Plzz Help

Hi,

As mentioned on the Medium Trust page, for Data access to work in Medium trust the ADO provider for it must be in the GAC.

So you can either use MS SQL or convince your host to install the MySql Connector on the sever which would put it in the GAC.

The latest mojoPortal from svn turnk has the new version of MySql Connector and I've been told it works in medium trust without being in the GAC but not sure its true as I haven't tested that myself. You can try replacing the MySql.Data.dll in your bin folder with version 5.1.3.0 which you can download from the MySql site or get from svn trunk. However, I think if it does work it will require re-compiling the solution.

The current relase version doesn't have the new MySql Connector.

Hope it helps,

Joe

11/3/2007 6:53:05 AM
Gravatar
Total Posts 17

Re: System.Security.SecurityException. Plzz Help

Hey Joe!

Thnx for giving time to time reply.

I followed your instructions and Downloaded the new 5.1.3.0 MySql.Data.Dll file and replaced with the existing  MySql.Data.Dll. Also my Hosting Provider will not going to install MySql Dll file into their GAC.

Now this Error is being displayed

I m really getting lost now........ Dnt know what to do now. Plzz help.........

Thank you

---------------------------------------------------------------------------------------

Could not load file or assembly 'MySql.Data, Version=5.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=5.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=5.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Stack Trace:

[FileLoadException: Could not load file or assembly 'MySql.Data, Version=5.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
mojoPortal.Data.dbPortal.SiteFolder_Exists(String folderName) +0
mojoPortal.Business.SiteFolder.Exists(String folderName) +5
mojoPortal.Business.WebHelpers.VirtualFolderEvaluator.VirtualFolderName() +531
mojoPortal.Web.UrlRewriter.RewriteUrl(HttpApplication app) +83
mojoPortal.Web.UrlRewriter.UrlRewriter_BeginRequest(Object sender, EventArgs e) +368
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

11/3/2007 7:02:27 AM
Gravatar
Total Posts 18409

Re: System.Security.SecurityException. Plzz Help

As I mentioned in my previous post. I think to use the newer version of MySql connector the mojoPortal code would have to be re-compiled against that version. I will do that for you and send you an email with a new mojoPortal.Data.dll in a little while.

Joe

You must sign in to post in the forums. This thread is closed to new posts.