PDA

View Full Version : سوال: Security Exception در هنگام ساختن wuc بصورت dynamic؟



Modifier
سه شنبه 22 تیر 1389, 11:58 صبح
سلام

من با اين دستورات زير :



Control toAdd = LoadControl("Address","", "StaticCount", "RandomCount", Session["adver_page"].ToString(), 1, 160, 161, 0, true);
Panel1.Controls.Add(toAdd);


توضيحات خطا :


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.



ميخوام يك كنترل بسازم و بزارم تو صفحه..
در حالت لوكال مشكلي نداره و ولي وقتي آپلود ميكنم Security Exception ميده...
وقتي commentميكنم درست ميشه..

اشكال از كجاست...؟

ممنون.

يا علي

Modifier
شنبه 26 تیر 1389, 15:13 عصر
با قرار دادن تنظيمات زير در web.config مشكلم حل شد...



<location allowOverride="true">
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
<trustLevel name="High" policyFile="web_hightrust.config"/>
<trustLevel name="Medium" policyFile="web_mediumtrust.config"/>
<trustLevel name="Low" policyFile="web_lowtrust.config"/>
<trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
</securityPolicy>
<!-- level="[Full|High|Medium|Low|Minimal]" -->
<trust level="Full" originUrl=""/>
</system.web>
</location>


فقط نميدونم اين كد چيكار ميكنه...؟
اصلا چي شد كه exception توليد شد و با اين كد حل شد؟

يا علي.