Question : ASP.NET to Sharepoint: master page, types, and other problems

I am trying to deploy an ASP.NET application under Sharepoint, and am getting stuck in two places.  (I am working off the suggestions in an article I found on CodeProject called "Converting an ASP.NET site into a SharePoint site" by srivatsan24.)

1. Begin with my existing project.
Generated a strong name keypair with sn.exe and used that in the Signing tab of Properties.

2. Add Web Deployment Project.
Selected these options:
"Merge all outputs to a single assembly"
"Enable Strong Naming" with the above snk file
Mark assemblies with AllowPartiallyTrustedCallersAttribute (APTCA).

3. Created a Sharepoint Web Application and site.
This makes an IIS application pool, web site, registers it in Sharepoint, makes a Virtual Directory.
The directory is Inetpub\wwwroot\wss\VirtualDirectories\www.mydomain.com80\

4. Build my solution.
The web deployment assembly name is "Foobar.webdeploy" and the output is in Foobar.webdeploy\Debug.

5. Copy the bin subdir there into the my site's bin.
This included two files: Foobar.dll and Foobar.pdb

Also from the Debug directory, copied Default.aspx into the site.

6. Modified the site's web.config as follows:
In the previously empty section:
</pageparserpath>
In the section:  

Change the global trust from "Minimal":

If I now go to my page (which is default.aspx in the site directory), it runs ok.
But this page has no server controls on it or anything, just some HTML.

It has this at the top:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Foobar._Default" %>

This was a minimalist attempt, and it worked.

But my real project is of course very elaborate, and for starters it uses a master page.  If I try to add a master page, I get stuck multiple ways (and these are the same problems as in my real project).

One path of instructions says to change the master page to be the Sharepoint default master page. So I moved the page content inside a tag  with ContentPlaceHolderID="PlaceHolderMain" and I set the @Page attribute MasterPageFile="~masterurl/default.master".

Now when I try to go to the page, I get this error:
Parser Error Message: The referenced file '/~masterurl/default.master' is not allowed on this page.
It doesn't seem to matter what token or pathname I put into that MasterPageFile.
This is the first problem I would like to solve, since those are really supposed to work.

The second problem comes when I change to my own MaserPageFile. I think it finds it, but I get a "Cannot load type" error.  One thing I am unclear on here is what the Inherits @Page directive is supposed to say (in any of these cases).  The assembly name?  Type name?  DLL filename?  Something else?  Should the web deployment be putting something there for me automagically?   What is that "Foobar._Default" name?

What I hope to do in the end is make my master page cascade off the default Sharepoint master page.  I am willing to add the PreInit() method to load the page or set up the context or whatever mumbo-jumbo is needed there, but thus far have not built my project with any Sharepoint references or code changes from my original ASP.NET.   My app currently has its own SiteMap and navigation panes and login such, but I would ultimately prefer to ditch that.  But for now I just want to get it working at all.

Where am I going wrong?

Answer : ASP.NET to Sharepoint: master page, types, and other problems

No, nothing is resolved, the page does not work at all.

i have received no helpful advice whatsoever.

Just people not reading the problem description, and you, offering snarky useless responses.
Random Solutions  
 
programming4us programming4us