.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Error: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net

I have had an ASP.net 3.5 web site working fine until I moved to a new VS 2008 SP2/SQL Server 2008R2 server.  
The web site seemed to be working fine with the old VS 2008 web server with a SQL Server 2005 database server.
Before moved to the new VS2008 SP2 web/SQL 2008 database server, testing on a new Vista workstation with
ASP.net development server seemed to be working fine. 

However, testing on this new VS 2008R2/SQL Server 2008 server with the a tabase created by backup and restore
from SQL 2005 database showed the following error massge.  There were 14 errors.  

Error 9 Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. \\webdataserver\e$\website\webpage.aspx  

What is the problem with "AspNetHostingPermission"?

View Complete Post

More Related Resource Links

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version


I am using Itext sharp to create a pdf. I am adding an image and I keep getting this error

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

it is this bit of code that is causing this


string imagepath = "C:\\BMSApplicationFiles\\PDFImages\\bullfrogWeb.gif";

//add the Image to the DOC
  Image bullfrogImage = Image.GetInstance(imagepath);
  bullfrogImage.SetAbsolutePosition(10, doc.PageSize.Height - 36);

If i comment this out, the PDF builds and no errors are thrown (there is just no image)

I don't understand cause I am am trying to do is read a file.

The directory does have full permission granted to IISUser

Any ideas why I am still geting this permissions error?

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPerm


Good Day all,

Having an issue with an outside user accessing my IIS7 box. I do not have this problem when running the website from my host machine. I found this post: Http://forums.asp.net/t/1371394.aspx. I assure you that this is not a solution because I am not storing any of my files on a network share. 

What do you think my approach should be. 

I already have read rights to IIS user to my BIN folder. 

Thanks for the help. 

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlCli

I have created a windows library control that accesses a local sql database I tried the following strings for connecting Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true" Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"   I am not running the webpage in a virtual directory but in C:\Inetpub\wwwroot\usercontrol and I have a simple index.html that tries to read from an sql db but throws the error System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)   at System.Security.PermissionSet.Demand()   at System.Data.Common.DbConnectionOptions.DemandPermission()   at System.Data.SqlClient.SqlConnection.PermissionDemand()   at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, etc etc  The action that failed was:DemandThe type of the first permission that failed was:System.Data.SqlClient.SqlClientPermissionThe Zone of the assembly that fa

In Reporting Services: Request for the permission of type 'System.Data.SqlClient.SqlClientPermissio

Hello all,In Reporting Services through http://myserver/mydbinstance/Pages/Report.aspx blah de blah blah, I get this error:Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.Actually, the report runs just fine, but some fields had the famous #Error in them. I put some old fashioned debug in my report to TRY, CATCH, END TRY and get the problem to the report so that I could see this report finally run in production. Yes, it runs just fine in VS2005. I have custom code in the report code window that does its own custom connection to an SQL database through "System.Data.SqlClient.SqlConnection" and "System.Data.SqlClient.SqlCommand" to pull in data that is not part of any of the datasources in the report. When I execute the report through the Report Manager or Report site under IIS, the report will run, but I get these errors in every field that uses functions to populate the data.I have searched the web for 3 days now, and the best answers involve using either CASPOL or the Microsoft .NET Framework 2.0 Configuration wizard in Administrative Tools on the server. (I understand that the wizard does the same thing as CASPOL, just through a GUI.) I have followed those steps, but still get the error.I do not know what I need to do to make these DLLs th

xbap Request for the permission of type System.Net.WebPermission failed



I've developed and XBAP application that talks to a WCF service.  I set my XBAP to partial trust and everything worked just fine.

I then added code to the WCF service that uses System.DirectoryServices to talk to my Active Directory server.  I tried to debug the XBAP after I added this code and I am recieving the following error.  Request for the permission of type System.Net.WebPermission failed.

When I set my XBAP to full trust everything works ok.  However I don't understand why I need to set my XBAP to full trust when it's the WCF service that uses System.DirectoryServices to talk with the Active Directory Server and not the XBAP application.


Thanks in advance!

Error: "Type 'System.Web.UI.UpdatePanel' is not defined"?

Can anybody tell me why I'm getting this error on the first line of all my aspx pages? The lines have a blue squiggly line underneath them:<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> Error: Type 'System.Web.UI.UpdatePanel' is not defined 

Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil' in asp.net mvc

I am getting following error in production but the same is not a repro in in local.> Error executing child request for> handler> 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'.> Inner Exception: Exception of type> 'System.Web.HttpUnhandledException'> was thrown.Stack Trace:    at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)    at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)     at System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)    at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)         at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)         at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11()    at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)     &

Sudden Error: Could not load type System.ServiceModel.Activation.HttpModule - Urgent Help Please


I have a windows 7 machine with IIS 7. I was hosting WCF services on IIS normally and i had a couple of services running.
Suddenly (i honestly did not do any configuration changes on my machine) all these services stopped working. When i try to browse the .svc file i get the following error:

"Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'"

Just in case this information is helpful, all these services are running on the basicHttpBinding.

Please help!

Need to fix this error : Type 'System.Web.UI.WebControls.CreateUserWizard' does not have a public


Hi all,

 i am usingVWD 2010 andwant to create a website supported under .net 3.5.

The deafault mater page has the loging pgaes already set up (.net 4.0) which is very good and helping to start.

But once i changed my project to run under .Net 3.5 , i could not have the account register webpage working and getting this error :

Parser Error Message: Type 'System.Web.UI.WebControls.CreateUserWizard' does not have a public property named 'LayoutTemplate'.


Any idea how can i fix this issue ??


Thanks ..




Error 1259 The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.


In my asp.net application i  have getting an error

Error 1259 The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.  
 How to solve this one

I configured this application in iis.

As per the many forum result . i changed the framworkwortion in asp.net  tab of iis proprty.

So kindly give a good solution for it



@ Page AutoEventWireup="false" CodeFile="IDNotification.aspx.vb" Inherits="IDNotification" Language

File system permission error during BACKUP service master key



I'm having a strange issue with file system permissions.

A backup database to file location e:\sqlbackup works fine.
A BACKUP SERVICE MASTER KEY or BACKUP MASTER KEY fails with the error ´MSG 15240, Level 16, State 1 Cannot Write into file ´e:\sqlbackup\file.bak' Verify that you have write permissions, etc...'

What am I missing?


System.Data.SqlClient.SqlException: Error converting data type nvarchar to datetime.


 Hi All,

I have recently moved a ASP.NET webserver from windows XP to
windows server 2008.
The website runs fine apart from anywhere that pulls a date
or uses the date from a JS date picker etc.

The error I am receiving is:

System.Data.SqlClient.SqlException: Error converting data type nvarchar to datetime.

Source Error:

Line 79:         cmd1.Parameters.AddWithValue("@EndDate", lblSearch2.Text);
Line 80:         conn.Open();
Line 81:         SqlDataReader reader = cmd1.ExecuteReader();
Line 82:         if (reader.HasRows)
Line 83:         {

Source File: c:\inetpub\wwwroot\folderx\pagex.aspx.cs    Line: 81

Stack Trace:

[SqlException (0x80131904): Error converting data type nvarchar to datetime.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951450
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849003
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject s

Self host error , The type initializer for 'System.ServiceModel.DiagnosticUtility' threw an except


A Self-host wcf service getting this error :
The type initializer for 'System.ServiceModel.DiagnosticUtility' threw an exception.
on line :
ServiceHost host = new ServiceHost(typeof(Service1)); 

SelfHostWCF's app.config
<?xml version="1.0" encoding="utf-8" ?>
                <behavior name="WcfServiceLibrary1.Service1Behavior">
                    <serviceMetadata httpGetEnabled="true" />
					<serviceDebug includeExceptionDetailInFaults="True" />
				<behavior name="NewBehavior">
					<serviceMetadata httpGetEnabled="true" />
					<serviceDebug includeExceptionDetailInFaults="True" />
                <binding name="NewBinding0" />

MSXML6 Installer Error; MSDN SQL 2005 Setup Failure; "failed because a higher version"; "system admi


I had similar problem as above, but had to add an additional registry editing step (not listed).


Here's complete write up of the steps that worked on this pc... (Thanks to the tip for the first fix from Xiaochuan's spaces http://cid-c06fe3569bc575d9.spaces.live.com/)


Initial Problem: Error installing MSDN SQL 2005 on Windows XP pro SP 2, due to MSXML6 "Setup Failed"


After reading plenty of posts, determine failure is isolated to running msxml6.msi installer.


I had two different errors running the MSXML6 installer.


Error #1 - MSXML6 (msxlm6.msi) install fails because "the system administrator has set policies to prevent this installation ..."

Error #2 - "Installation of MSXML 6.0 Parser failed because a higher version is already exits on the machine. To proceed, uninstall the higher version and then run MSXML 6.0 Parser Setup again."


So here's the steps that fixed both, and allowed msxml6.mxi to be inastlled... and subsequently sql msdn...


Install #1 - Run msxml6.msi (you can get this off SQL install CD (in D:\ENGLISH\SQL200

.NET error Request for the permission of type securityPermission for shared assembly on network


      We have following error while running one of .net assembly from our COM application.

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

The COM application built on mixed mode with .NET2.0 and VC++2008 and runs on various enviroments. but at
customer production fails with above error. Tried with different settings and CASPOL commands below but
still we get errors when running from SHARED drive

-Registered with regasm C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>regasm /codebase \\Machinexxx\folder1\\bin\Validation.dll

-Gave full trust to assemblies from .net configuration manager.
- caspol.exe -quiet -machine -addgroup All_Code -url "\\machine-xx01\folder1\Bin\*" LocalIntranet
- caspol.exe -m -ag LocalIntranet_Zone -url "\\machine-xx01\folder1\Bin\*" FullTrust –n FullTrustshare
after various caspol commands, which were successful, we did restart machine, but still when running
the application with that DLL it will throw above security error.

Any p

Error: The type 'System.Windows.DependencyObject' is defined in an assembly that is not referenced



I have an ObservableCollection which I would like to sort.

<TLstNodeData> SWNodeList = TopNode.SubNodes.OrderBy(SNode => SNode.NodeDispText).ToList();

In a WindowsForm application targeting the .NET 4.0 Framework it compiles and works as expected.

If I do this in a WCF Service in my web project also targeting the .NET 4.0 Framework I get the following error.

Error 1 The type 'System.Windows.DependencyObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

When I add this

Crawl Error - Error in the Site Data Web Service. (Exception of type 'System.OutOfMemoryException'


I have a Sharepoint site that includes a WIki library.  Recently searches have stopped returning any hits from the Wiki pages.  (Search hits from documents and discussions are correctly returned.)  When I check the crawl log from Shared Services Admin site, I see the following error every time a crawl is performed:



Error in the Site Data Web Service. (Exception of type 'System.OutOfMemoryException' was thrown.)


The URL above is part of the Wiki library.  When I look at the raw Sharepoint logs, I see the following entries every time a crawl is performed:


11/26/2007 05:01:50.93  mssdmn.exe (0x1F98)                      0x1368 Search Server Common           MS Search Indexing             7hp2 Monitorable EnumerateListFolder fail. error 2147755542, strWebUrl http://cao.tfn.com/Caopedia, strListName {e9acf8e9-f23f-4afd-b8e9-6eaf6b0101db}, strFolder  
11/26/2007 05:01:50.93  mssdmn.exe (0x1F98)                      0x1368 Search Server Com

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend