views:

20

answers:

1

When creating a new web form the default page class is System.Web.UI.Page. Can this default be changed in visual studio 2010 so that it uses a custom class that we created that inherits from System.Web.UI.Page?

Cheers!

+1  A: 

This requires editing a file within a zip.

  • Open: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\Web\1033\WebForm.zip

  • Extract and edit default.aspx.cs. Modify as you like!

  • Save that file back into the .zip.

Repeat the same in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\Cache\CSharp\Web\1033\WebForm.zip

Any new webform items you add to projects will contain the modifications you made.

Ensure the changes are in both ItemTemplates and ItemTemplatesCache.

p.campbell
Remember, this changes it for **all** projects, not just the **current** project.
rockinthesixstring
This worked a treat thanks! I didn't have the ItemTemplatesCache folder, so I changed the ItemTemplates folder, and restarted visual studio and it accepted the changes.
campo
@rockinthesixstring thanks for the heads up on this
campo