简体   繁体   中英

ReSharper: Find usage of a Page.aspx

Normally we reference a page using URL (eg login.aspx) when we create a form or a navigation menu... and when Re-sharper try to find the usage of the class (eg login), it doesn't find the places where I put that URL (eg unregister.aspx or index.aspx). I wonder if somehow we can make explicitly reference it. I don't know if we can't do it by ReSharper comment(something like this) and if it's recommendable or not:

// ReSharper THIS IS A USAGE OF "Login Class"
<a href="~/Login.aspx" ...

The only option that I can think of creating a static public property in the page (eg PageUrl) for store the page name. like:

public static string PageUrl = "Login.aspx";

and the usage will be something like:

<a href="~/<%=Login.PageUrl %>" ...

that will work! but still a little messy.

  • Reason:

I am working in a big old project that required maintenance and when you change a page you may have to change the page that used it, because it's possible that you want to maintain the related pages too.

updated 8/8/2012

  • Conclusion:

Based on the comments, especially of the one from Peter Ritchie, implementing a feature like this because the tools doesn't, it is not recommendable for many reasons (coupling, complexity, time, etc), so this is worthless. Maybe a future version of Resharper or Visual Studio can include this feature.

The best alternative: it's to create a site map (for a developer).

This open source project might be a good place to start. It's meant to filter out unused images, but it should be pretty easy to change so it looks for unused files.

Find unused images in VS Web Projects

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM