How to rename my asp.net webpage

I have a page name with XYZ.aspx

Now I want to change ABC.aspx, how do I do this?

When I directly change it from the solution browser, it gives me an error.

Can someone help me with this?

thanks

Smartdev

+4
source share
2 answers

ASP.NET files usually consist of 1-3 files depending on the type of project and the file itself. In this case, there is always a * .aspx markup file, and then, possibly, there will be a file with the code ".aspx.cs" and an additional, as well as an additional * .aspx.designer.cs constructor file. If you rename a file, you need to update the code in different places based on the structure of the file itself.

If you create more than one file that makes up your ASP.NET page, you will want to update the header of the .aspx file as follows:

<%@Page CodeBehind="XYZ.aspx.cs" Inherits="XYZ" %> 

to

 <%@Page CodeBehind="ABC.aspx.cs" Inherits="ABC" %> 

Then in the code behind the file

 public partial class XYZ : Page { } 

to

 public partial class ABC : Page { } 

Finally, if there is a * .designer.cs file, you will also want to update it:

 public partial class XYZ : Page { } 

to

 public partial class ABC : Page { } 

This should cover all files!

+9
source

To change the aspx file name (I use vs2012) and related files, click once on the file name in the solution browser and press once again to select the file name, change the name and enter ... vs rename the file code of the file and designer automatically and change the tags that link them. As nathan said above, it does not rename C # to the code behind to reflect the file name (which would be good practice) ... and it doesnโ€™t matter if it does a wide search of links and more skew links to the file. So itโ€™s best to manually find the files in the files throughout the solution to check, and all naming conventions are good.

It should do it

+1
source

Source: https://habr.com/ru/post/1306717/


All Articles