Md. Arafat Al Mahmud
Md. Arafat Al Mahmud

Reputation: 3214

why do I need Default.aspx.designer.cs file?

when I used to create ASP.NET website there was only one code behind file as for example Default.aspx.cs. Meanwhile I created ASP.NET web application, this time visual studio generated an additional code behind file as Default.aspx.designer.cs My question why do I need it ? I inherited a class other than the Page class, so I removed "inherits="MySite.Default". But I've got an error mentioning identifier expected in the Default.aspx.designer.cs file. Please help me in this regard too.

Upvotes: 2

Views: 6810

Answers (1)

Luke Baughan
Luke Baughan

Reputation: 4686

the designer files are auto-generated by visual studio and act like scaffolding for the code you write within the aspx and aspx.cs files. Because these are auto-generated you never need to or should touch these files.

I would advise you put the code back where it was, inherit from your desired other class as you wish and let visual studio worry about the designer file.

Simply make the changes your need to those the aspx and aspx.cs files and forget about the designer files.

Find more info here: aspx.designer.cs how does it work?

Upvotes: 2

Related Questions