campo
campo

Reputation: 1902

Change the default page class in visual studio

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!

Upvotes: 2

Views: 535

Answers (1)

p.campbell
p.campbell

Reputation: 100567

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.

Upvotes: 2

Related Questions