views:

255

answers:

4
+1  A: 

Type.GetType(string) requires an assembly-qualified type name.

Anton Gogolev
I don't have an explicit assembly here, just an ASP.NET website. How should I reference the assembly?
Petras
+4  A: 

The reason this is occurring is because you are compiling each page individually becuase you are using a website instead of a web project.

So each page is an individual assembly that doesn't know about the other. If you want to use the GetType I would recommend changing to a web project to make your life easier.

Nick Berardi
+1. I never understood the difference between the two.
Dead account
+2  A: 

In the markup for your aspx page you can specify the master page type you are using like so:

<%@ MasterType VirtualPath="~/MasterPage.master" %>

In any case, you can get the type of the current master page back from a call like this in your codebehind:

protected void Page_Load(object sender, EventArgs e)
{
 Type t;
 t = this.Master.GetType();
}
Steve Willcock
Above this may work but in my actual problem the MasterPage is not used by the aspx
Petras
Ok, maybe it's best if you explain why you need a reference to the master page then if it's not used by that page? There may be another, easier way to achieve what you are trying to do.
Steve Willcock
A: 

add to what Steve suggested, i use his method all the time, also check this MSDN article about MasterType directive.

http://msdn.microsoft.com/en-us/library/ms228274.aspx