Hi all
I deployed my website (TheBeerHouse Website) to the shared host enviroment
I have a database account named 'monila_monilaDBLogin' with full access on my database.I have no access to dbo account so i downloaded the open source of Membership provider from
http://download.microsoft.com/downlo...kitSamples.msi
and i replaced all of the 'dbo' to 'monila_monilaDBLogin' then i compile the project and use that dll in my website like:
<membership defaultProvider="ELearningCenter_MembershipProvide r">
<providers>
<add connectionStringName="ELearningCenterConnectionStr ing"
applicationName="/"
enablePasswordRetrieval="true" enablePasswordReset="true"
requiresQuestionAndAnswer="false" requiresUniqueEmail="true"
passwordFormat="Encrypted" maxInvalidPasswordAttempts="5"
passwordAttemptWindow="10" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
name="ELearningCenter_MembershipProvider" type="Microsoft.Samples.SqlMembershipProvider,Prov iderToolkitSampleProviders,Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</providers>
</membership>
<roleManager defaultProvider="ELearningCenter_RoleProvider" enabled="true" cacheRolesInCookie="true" cookieName="ELearningCenterRoles">
<providers>
<add connectionStringName="ELearningCenterConnectionStr ing" applicationName="/"
name="ELearningCenter_RoleProvider" type="Microsoft.Samples.SqlRoleProvider,ProviderTo olkitSampleProviders,Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</providers>
</roleManager>
<profile defaultProvider="ELearningCenter_ProfileProvider">
<providers>
<add name="ELearningCenter_ProfileProvider"
connectionStringName="ELearningCenterConnect ionString"
applicationName="/" type="Microsoft.Samples.SqlProfileProvider,Pro viderToolkitSampleProviders,Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</providers>
<properties>
<add name="FirstName" type="String"/>
<add name="LastName" type="String"/>
<add name="Website" type="String"/>
<group name="Preferences">
<add name="Theme" type="String"/>
<add name="Newsletter" type="Newsletters.BusinessLogicLayer.SubscriptionT ype"/>
</group>
<group name="Forum">
<add name="Posts" type="Int32" />
<add name="AvatarUrl" type="String" />
<add name="Signature" type="String" />
</group>
</properties>
</profile>
ok! what is problem? Membership is work fine but when i want get users profile or write users profile , Security Exception occured! this is the detail of error:
'---------------------------------------------------------------------------------------
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:
[No relevant source lines]
Source File: App_Code.0a3uskaz.5.cs Line: 81
Stack Trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
Microsoft.Samples.SqlProfileProvider.ParseDa taFromDB(String[] names, String values, Byte[] buf, SettingsPropertyValueCollection properties) in SqlProfileProvider.cs:532
Microsoft.Samples.SqlProfileProvider.GetProp ertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc) in SqlProfileProvider.cs:203
Microsoft.Samples.SqlProfileProvider.GetProp ertyValues(SettingsContext sc, SettingsPropertyCollection properties) in SqlProfileProvider.cs:146
System.Configuration.SettingsBase.GetPropert iesFromProvider(SettingsProvider provider) +410
System.Configuration.SettingsBase.GetPropert yValueByName(String propertyName) +117
System.Configuration.SettingsBase.get_Item(S tring propertyName) +89
System.Web.Profile.ProfileBase.GetInternal(S tring propertyName) +36
System.Web.Profile.ProfileBase.get_Item(Stri ng propertyName) +68
System.Web.Profile.ProfileBase.GetPropertyVa lue(String propertyName) +4
ProfileCommon.get_FirstName() in App_Code.0a3uskaz.5.cs:81
MA.ELearningCenter.UI.UserControls.UserProfi le.Page_Load(Object sender, EventArgs e) in f:\hshome\monila\monila.ir\UserControls\UserProfil e.ascx.cs:40
System.Web.Util.CalliHelper.EventArgFunction Caller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegatePro xy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolea n includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAsser t(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContex t context) +49
ASP.admin_accounts_edituser_aspx.ProcessRequ est(HttpContext context) in App_Web_wkzlxkry.2.cs:0
System.Web.CallHandlerExecutionStep.System.W eb.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExec utionStep step, Boolean& completedSynchronously) +64
'---------------------------------------------------------------------------------------
windows server's host only accept "Medium Trust Level".In my pc when i add
<trust level="Medium" />
in web.config and i use default membership provider in System.Web.dll and database login 'dbo', all work fine!
any idea???
i confused!
please help me!
A king,in my own mind