Bug #45980 Profile Provider Fails on Shared Web Hosting
Submitted: 6 Jul 2009 19:14 Modified: 7 Jul 2009 10:09
Reporter: Darlington Adibe Email Updates:
Status: Duplicate Impact on me:
Category:Connector / NET Severity:S2 (Serious)
Version:6.0.4 OS:Windows
Assigned to: CPU Architecture:Any

[6 Jul 2009 19:14] Darlington Adibe
Profile Provider fail with the following error when saving profil data.

runs fine on my local testing system, but when i upload to my Share hosting Account with GoDaddy i get the following error

Server Error in '/livesms/pages' 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=, 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=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   MySql.Web.Profile.MySQLProfileProvider.EncodeProfileData(SettingsPropertyValueCollection collection, Boolean isAuthenticated, String& index, String& stringData, Byte[]& binaryData) +0
   MySql.Web.Profile.MySQLProfileProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection) +214
   System.Configuration.SettingsBase.SaveCore() +375
   System.Configuration.SettingsBase.Save() +93
   System.Web.Profile.ProfileBase.SaveWithAssert() +31
   System.Web.Profile.ProfileBase.Save() +63
   System.Web.Profile.ProfileModule.OnLeave(Object source, EventArgs eventArgs) +8773900
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3072 

How to repeat:
Just try to save and retrive profile data

My Profile defination in my web.config is follow

    <profile defaultProvider="MySQLProfileProvider" enabled="true" automaticSaveEnabled="true">
        <add connectionStringName="LiveSMSDB" name="MySQLProfileProvider" applicationName="/" autogenerateschema="true"
             type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web" />
        <!--<add name="Detail" type="Triative.LiveSMS.DashBoard.AccountDetail" serializeAs="Xml" allowAnonymous="false" provider="MySQLProfileProvider"/>-->
        <group name="Account">
          <add name="SenderID"  serializeAs="Xml" allowAnonymous="false" type="String" defaultValue="LiveSMS"/>
          <add name="Balance" serializeAs="Xml" allowAnonymous="false" type="int" defaultValue="10" />
        <group name="Contact">
          <add name="FirstName" serializeAs="Xml" allowAnonymous="false" type="String" defaultValue="" />
          <add name="LastName" serializeAs="Xml" allowAnonymous="false" type="String" defaultValue="" />
          <add name="MobilePhone" serializeAs="Xml" allowAnonymous="false" type="String" defaultValue="" />
          <add  name="Organisation" serializeAs="Xml" allowAnonymous="false" type="String" defaultValue=""/>
        <group name="Options">
          <add name ="ReceiveMails" serializeAs="Xml" allowAnonymous="false"  type="Boolean" defaultValue="true"/>
          <add name ="ReceivePartnerMails" serializeAs="Xml" allowAnonymous="false" type="Boolean" defaultValue="true"/>
          <add name ="HTMLMailFormat" serializeAs="Xml" allowAnonymous="false" type="Boolean" defaultValue="true"/>

Suggested fix:
[7 Jul 2009 6:25] Tonci Grgin
Hi Adibe and thanks for your report.

I believe it is a duplicate of verified one (Bug#45153). Can you please confirm my suspicion by giving the connector full trust or put it in the GAC? If your code works after this change then we have a duplicate.
[7 Jul 2009 9:58] Darlington Adibe
It works well on my Testing/Developing computer with the dll in the Bin folder.
it only fails when I upload to my shared hosting account on GoDaddy.

I can't chnage the trust level on the hosting server nor can I Add it the GAC
[7 Jul 2009 10:04] Tonci Grgin
I strongly feel this is the same problem as reported in Bug#45153 so I'm marking your report as duplicate.
[7 Jul 2009 10:09] Darlington Adibe
So is there any solution or work around to this yet?
[7 Jul 2009 10:11] Tonci Grgin
Besides two I already gave, no... I'm trying to escalate the original report now.
[23 Jul 2009 15:41] Marco Cianciaruso
seem to be exactly my problem

[16 Oct 2009 17:21] Marco Cianciaruso
it's my problem too... and i'm using the connector 6.1.2.
Any workaround?
[20 Nov 2009 11:14] sam bangayan
I have the same problem with darlington.  works great on dev machine but when uploaded to godaddy profile provider fails because of the trust level issue.

so is there a workaroun already?
[27 Nov 2009 21:55] Egon Dadalt
I have the same problem with darlington.  
works in the dev machine but when uploaded to uolhost fails because of the trust level issue (Medium Trust).

so is there a workaroun already?
[4 Feb 2010 15:32] Marco Cianciaruso
Are this bug forgotten???
There is any plan to solve it?
[23 Feb 2010 0:40] Dev Dev
I have same problem on GoDaddy and can also recreate if I set security policy to medium on my local machine.

Looking through the source code, the problem is EncodeProfileData / DecodeProfile Data - there is a call to SettingsPropertyValue.SerializedValue. This causes the security exception.

For myself, I've rebuilt it and removed the serialized Option.
[23 Feb 2010 8:12] Tonci Grgin
Sending note to Reggie.
[13 Feb 2011 11:50] Thu Tin
Has this buy been fixed?  I am  using Connector 6.2.4 and having the same issues.