Publishing ASP.NET 1.1 App to Windows Sharepoint Services Web Site


Yesterday I built a small web site and I tried to publish it to my usual web site www.dotnetlounge.co.nz.  This site has been entirely running Windows Sharepoint Services until now.  I used Sharepoint Central Administration to exclude my virtual directory from WSS and I ran my MSI installer on the machine.  The WSS web site is the default and my MSI which was created with Visual Studio .NET 2003 only installs to the default web site.  My server is running Windows Server 2003 and is also a domain controller.


Well it all turned to custard and I had to create a new web site on the machine, differentialted by a new host header.  So now to isntall updates I have to run the MSI and then manually copy the files from the default web site to the alternate.  Also, I can't use the dotnetlounge URL.


How can you install an ASP.NET application to a virtual directory that's under a Windows Sharepoint Services web site?


Here's the error that I got.  Clearly my web site can't get System.Web.AspNetHostingPermission.  I played around with the settings for a while and did a few google searches but no result so far.   I believe it's something to do with the custom security settings created by Windows Sharepoint Services, the web site isn't on a network share.


I'll keep researching...


Server Error in '/NZSurvey' 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.Web.AspNetHostingPermission, System, Version=1.0.5000.0, 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.Web.AspNetHostingPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.]
System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken) +666
System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride) +0
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +88
System.Security.CodeAccessPermission.Demand() +62
System.Web.HttpRequest.get_Params() +91
ASPNetPortal.WebForm1.OnInit(EventArgs e)
System.Web.UI.Control.InitRecursive(Control namingContainer) +241
System.Web.UI.Page.ProcessRequestMain() +2106
System.Web.UI.Page.ProcessRequest() +218
System.Web.UI.Page.ProcessRequest(HttpContext context) +18
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87





Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

Comments (5)

  1. Lamont says:

    As you know (or maybe not?), when you extend a virtual server for WSS, WSS imposes a number of WSS-specific extentions basically taking over the virtual server that’s running your WSS site. If you want an ASP.NET app to run in a directory within your WSS web, you’ll need to deploy your app under the "_layouts" directory in your WSS web. It’s important that you do this so that WSS won’t try to content for your site in the WSS content database.

    That would be the first thing I try to make sure that your app at least runs correctly.

    Are you also trying to redirect to your app when you enter http://www.dotnetlounge.co.nz?

  2. Paul Andrew says:

    To Lamont: Thanks for replying I did know all that. I had thought that the Exclude Directory command would allow me to bypass the WSS addins. Layouts dir is no good for me – I don’t like the resulting URLs. You can also put .ASPX pages into document libraries and run code there. I have ended up deploying to http://www.vs.net.nz/nzsurvey instead.

  3. Lamont says:

    Really sucks that you had to go that route. Product enhancement request anyone? 🙂

  4. Alex says:

    Paul:

    I thought that using the CSP provider and strong-naming the app, then adding the .DLL to the GAC on the WSS box, would be enough to avoid the ugly workaround you did.

    I think, though, that I was wrong; it seems to be a simple enough ask to be able to enumerate all subwebs from a WSS site via ASPX 1.1, esp. using SOAP against some of the builtin Web Services that come with WSS. That is what I am attempting to do; I’d like to populate a dropdown in a signup form for several subsites all running WSS. However, I run into the same (security) issues as you seem to have and I am likewise unwilling to put all apps that need to access the Sharepoint Object Model in _layouts.

    Any breakthroughs in your research, I’d appreciate hearing back: mondalea@usa.redcross.org

    Thanks,

    Alex

  5. Alex says:

    Actually, I managed to cajole my app into working. The trick was to create a trusted code group by URL and add my (WSS excluded) app to that group (also have the .DLL in the GAC which is probably redundant). It is fairly ugly I grant you, but it works without having to move the app into _layouts or using a non-WSS URL. HTH,

    Alex

Skip to main content