Welcome Guest Search | Active Topics | Members | Log In | Register

Security Exception - trust level not enough Options · View
johnson
#1 Posted : Tuesday, February 13, 2007 11:03:25 PM
Rank: Newbie

Groups: Member

Joined: 1/23/2007
Posts: 9
Points: 27
System.Security.SecurityException: Security error - is what i get in the exception report and it even says contact your administrator. Please help me regarding this issue. I am trying to deploy ASPDating application on my server. I am getting this error. My application does not provide any knowledge base to resolve this issue
cyberviral
#2 Posted : Tuesday, February 13, 2007 11:07:10 PM
Rank: Administration



Groups: Administration

Joined: 1/4/2007
Posts: 59
Points: 167
Location: Chennai
Please follow the steps -

Step 1: On the Web server, open Administrative Tools, and then double-click Microsoft .NET Framework Configuration.

Step 2: Click the Runtime Security Policy, expand Machine, and then expand Code Groups.

Step 3. Right-click All_Code, and then click New.

Step 4. Select Create a new code group. Give your code group a relevant name, such as the name of the applications share. Click Next.

Step 5. In the Choose the condition type for this code group list, select URL.

Step 6. In the URL box, type the path of the share in the following format:
file:////MACHINE_NAME\ASPDating\*

[ * - wildcard for all that contains inside the folder]

Step 7. Click Next. On the next page, select Use an existing permission set, and then give FullTrust set.

Step 8. Click Next, and then click Finish.

Step 9. Restart Microsoft Internet Information Services (IIS) to restart the ASP.NET worker process.

Hope this works....
To earn money online is easy, our website finds it difficult to learn it
johnson
#3 Posted : Tuesday, February 13, 2007 11:10:06 PM
Rank: Newbie

Groups: Member

Joined: 1/23/2007
Posts: 9
Points: 27
Thank you for your quick reply, But i am not able to view any web server settings... How to access the configurations. on further resource I found that to some modification must done in %windir%\Microsoft.NET\Framework\{version}\CONFIG. All I need to know is where aer these files in my web server. Please help me locate the folder in the filesystem
cyberviral
#4 Posted : Tuesday, February 13, 2007 11:12:42 PM
Rank: Administration



Groups: Administration

Joined: 1/4/2007
Posts: 59
Points: 167
Location: Chennai
You have not installed the Framework SDKs on your server I suppose. Only if you install it you can see the Microsoft .NET Framework Configuration under Administrative Tools.

Click start->run and type cmd and in the command prompt run the following command

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust
-exclusive on

Hope this works..
To earn money online is easy, our website finds it difficult to learn it
senthil
#5 Posted : Tuesday, February 13, 2007 11:14:22 PM
Rank: Member

Groups: Member

Joined: 1/3/2007
Posts: 20
Points: -40
You say that you have problem with your server. May i know where is the server? Is it a third party hosting provider's server or you are running your own server locally?
senthil
#6 Posted : Tuesday, February 13, 2007 11:24:22 PM
Rank: Member

Groups: Member

Joined: 1/3/2007
Posts: 20
Points: -40
You say that you have problem with your server. May i know where is the server? Is it a third party hosting provider's server or you are running your own server locally?
REMEMBER THAT by default all applications will run in Full Trust Level , so you wont be having a problem when you host locally. THe problem will only start when you host on some remote server. Possible errors you may get are


Server Error in '/ApplicationName' Application.

Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'ApplicationName.Global'.

Source Error: Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="ApplicationName.Global" %> Source File: Path of Application \global.asax Line: 1


OR

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: Security error.

Source Error:

Line 30: private static bool __intialized = false; Line 31: Line 32: public Global_asax() { Line 33: if ((ASP.Global_asax.__intialized == false)) { Line 34: ASP.Global_asax.__intialized = true;


If you are running locally then please consider the following changes.


If you are not able to set the trust level for your server then you should implement this in your machine.config/web.config. Edit your config file as shown below

<system.web>

<trust level="Full" originUrl="" />

inside the system.web tag this trust tag must come

To lock applications to override this per application in machine.config

<location allowOverride="false">

<system.web>

<trust level="Full" originUrl="" />

</system.web>

</location>

Give the appropriate URL above

Now create a custom level based on Medium level, first go to $\%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG and find a configuration file named web_mediumtrust.config then open and modify it as given below.

yourserver.com\ASPDating directory path must be included properly. Permissions must be changed accordingly

<IPermission class="FileIOPermission" version="1" Read="$AppDir$" Write="\ASPDating;$AppDir$" Append="$AppDir$"PathDiscovery="$AppDir$" />

Rename the file to my file something.config

Now add the below line to your machine.config

<system.web>

<trustLevel name="CustomMedium" policyFile="something.config" />

</system.web>

Please tell me whether this helps
ravi
#7 Posted : Wednesday, February 14, 2007 10:32:47 AM
Rank: Member

Groups: Member

Joined: 1/15/2007
Posts: 22
Points: 66
I hope Johnson is on a third party hosting who does not support full trust levels. Usually to secure the file system from the ability of the programmer the hosting server admins modify the global configurations files such that they are not overridden by the hosting space consumer. There will be a attribute in the XML schema of the configuration. Its looks like inherit=false, once the inherit is set to false then it is for sure that the applications hosted on the third party server space will override the trust level. By default there will be full trust level, but the hosting admins usually set to medium where by preventing File System attacks. So in this case Johnson will not be able to do anything rather than switching to a dedicated server or change the host or host his one server. Usually all host run on medium level considering the security in mind.

All the above are my perception and I am not very sure about it. Need Experts to comment on it
johnson
#8 Posted : Wednesday, March 07, 2007 3:02:41 AM
Rank: Newbie

Groups: Member

Joined: 1/23/2007
Posts: 9
Points: 27
Thank you for the resolution, just now I happened to see the replies. I have found an alternative towards this issue. Here after i am not going to rely on applications that demands trust levels to be full. No third party hosting providers are allowing maximum trust. I cant go for dedicated hosting with my current budget. If you can find an alternative for this please let me know. But most people told me that no shared hosting providers can give it.

Regards
Brick wall
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.931 seconds.