ASP.NET 2.0 pages in a Sharepoint 2003 website.

Today I ran into the problem of running ASP.NET 2.0 aspx pages in a Sharepoint 2003 website.

Let's say you have the following situation: you have a extranet Sharepoint portal on http://extranet.MyCompany.com and you want to have ASP.NET 2.0 pages under http://extranet.MyCompany.com/MyPages.

One problem, well if you can call it a problem, is that Sharepoint is running on .NET 1.1 and my pages on .NET 2.0. So after copy and paste (xcopy) of my pages to a subfolder of the sharepoint website I did the following.:

  1. First we need to create an application for the subfolder (ex. MyPages). So go to the properties and create the application.
  2. Then set on the ASP.NET tab the version to v2.0.
  3. So far sa clear. But the problem is that Sharepoint uses an ISAPI for the ASPX pages and will handle my ASPX page as a sharepoint page. To solve this you need to do step 4
  4. Start a command window (cmd) and type the following command:
    "C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN\stsadm.exe" -o addpath -url http://extranet.mycompany.com/MyPages -type exclusion
    With this the Sharepoint will exclude all the pages from this folder from Sharepoint processing.
  5. After this we are a step closer to the solution. If you have no problems anymore in this phase. Great. Otherwise you can have some problems with the Trust level exception. Well I had it. If you have it: continue with step 6
  6. Open the web.config of your MyPages directory.
  7. Here you need to add the following configuration in the <system.Web>

    <httpHandlers>

       <clear />  
         <
    add verb="*" path="*.aspx"  
               type
    ="System.Web.UI.PageHandlerFactory,

    System.Web, Version=1.0.5000.0, Culture=neutral,

    PublicKeyToken=b03f5f7f11d50a3a" />

          <add path="WebResource.axd" verb="GET"

    type="System.Web.Handlers.AssemblyResourceLoader" validate="True" />

    </httpHandlers>

     

        <!--

    Set the trust to Full. WSS configures a very restrictive trust policy that does not allow ASP.NET Web application to run correctly.

    -->

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

    <!--

    Enable the session module. This can also be enabled on the WSS Web.config, but is not enabled by default. If you receive the following message: Parser Error Message: The module 'Session' is already in the application and cannot be added again. You can remove the following <httpModules></httpModules> section as session is already enabled on the virtual server.

    -->

    <httpModules>

      <add name="Session"
        type
    ="System.Web.SessionState.SessionStateModule"/>

    </httpModules>

     

    <!-- Enable session state for all the pages in the Web application. -->

    <pages enableSessionState="true" enableViewState="true"

        enableViewStateMac="true" validateRequest="false" />

So, I hope this was a help for you.
For me it was. ;-)

Published Friday, August 18, 2006 6:42 AM by wesleyw

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above:
Powered by Community Server (Non-Commercial Edition), by Telligent Systems