Visual Studio .net template creation

B

Brian Barnes

I am trying to create a template code behind file for a website which all
pages should be inherited from. This base class however, when I try to view
the aspx page in Visual studio .NET (2002), it gives me the error:

The file failed to load in the web form designer. Plese correct the
following error, then load it again: An exception occurred while trying to
create an instance of GManWebSync.templates.WebBase (the base class). The
exception was "Object reference not set to an instance of an object."

Despite the fact that the file displays as expected in the web browser. I am
able to view the html code of the page so is more of a nusance. I have moved
the header html tag to be written from the template, however I have not
taken out the header section of all the pages yet (but this problem occurs
with all pages). I am sure that all varibles are initialised before they are
used (assuming "titlebar = CType(LoadControl(Request.ApplicationPath &
"/Components/comtop.ascx"), comTop)" initalises titlebar) as it compiles and
functions as expected

The page structure is going to be a title bar (initialised with the above
line) and then a table with 2 columns with a menu in the left column
(currently not shown (as I am having difficulties including it), but
designed as a component) and a maintaince side in the right (in which my
manager wants to have some changes reflected in the menu e.g. changing a
users name will change the link in the left menu) . The template is designed
to have the code to write the header information, include the title bar (it
is a basic component), write the table, include the menu, write the
maintaince page (which inherits the template page) and close the table and
body.

Any suggestions as to what I should look at closer
 
B

Brian Barnes

Brian Barnes said:
I am trying to create a template code behind file for a website which all
pages should be inherited from. This base class however, when I try to view
the aspx page in Visual studio .NET (2002), it gives me the error:

The file failed to load in the web form designer. Plese correct the
following error, then load it again: An exception occurred while trying to
create an instance of GManWebSync.templates.WebBase (the base class). The
exception was "Object reference not set to an instance of an object."

Despite the fact that the file displays as expected in the web browser. I
am able to view the html code of the page so is more of a nusance. I have
moved the header html tag to be written from the template, however I have
not taken out the header section of all the pages yet (but this problem
occurs with all pages). I am sure that all varibles are initialised before
they are used (assuming "titlebar =
CType(LoadControl(Request.ApplicationPath & "/Components/comtop.ascx"),
comTop)" initalises titlebar) as it compiles and functions as expected

The page structure is going to be a title bar (initialised with the above
line) and then a table with 2 columns with a menu in the left column
(currently not shown (as I am having difficulties including it), but
designed as a component) and a maintaince side in the right (in which my
manager wants to have some changes reflected in the menu e.g. changing a
users name will change the link in the left menu) . The template is
designed to have the code to write the header information, include the
title bar (it is a basic component), write the table, include the menu,
write the maintaince page (which inherits the template page) and close the
table and body.

Any suggestions as to what I should look at closer

It appear that this problem is a Visual Studio corruption problem as I went
to a backup of this site (before I first saw this error) and am still having
the problem. I am doing a repair install at present and will let you know
how it goes.
 
B

Brian Barnes

Brian Barnes said:
It appear that this problem is a Visual Studio corruption problem as I
went to a backup of this site (before I first saw this error) and am still
having the problem. I am doing a repair install at present and will let
you know how it goes.

Well it didn't go to well, I still have the same problem. The backup does
not work, nor does the original (although another website I am working on
does). I am sure that when I took the backup, there was no problem
 
B

Brian Barnes

Brian Barnes said:
Well it didn't go to well, I still have the same problem. The backup does
not work, nor does the original (although another website I am working on
does). I am sure that when I took the backup, there was no problem

Now this is really getting confusing. My web service .asmx and .asmx.vb
files (when double clicking on them in the solution explorer) come up with
the error:

An exception occurred while trying to create an instance of GManWebSync.Base
(the Base class for the web service, not to be confused with
GManWebSync.templates.webBase). The exception was "HttpContext is not
available. This class can only be used in the context of an ASP.NET
request".

Despite the fact that the web service works as per normal (on both a backup
(that was taken before the original error, and was working perfectly) and my
most recent version), and another web site (as a completely different
project) has no issues whatsoever. I can however right click the file and
select view code to see the code. The only change to the system that I have
done is XP service pack 2.

Any idea's before I have to re-create the project?
 
B

Brian Barnes

Brian Barnes said:
Now this is really getting confusing. My web service .asmx and .asmx.vb
files (when double clicking on them in the solution explorer) come up with
the error:

An exception occurred while trying to create an instance of
GManWebSync.Base (the Base class for the web service, not to be confused
with GManWebSync.templates.webBase). The exception was "HttpContext is not
available. This class can only be used in the context of an ASP.NET
request".

Despite the fact that the web service works as per normal (on both a
backup (that was taken before the original error, and was working
perfectly) and my most recent version), and another web site (as a
completely different project) has no issues whatsoever. I can however
right click the file and select view code to see the code. The only change
to the system that I have done is XP service pack 2.

Any idea's before I have to re-create the project?

Recreation didn't work. However, I now have a work around. Whenever I want
to go into design mode, I have it inherit page (as opposed my page template
base class).

I'm still looking for a more perminant solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top