Jaider
Jaider

Reputation: 14914

ReSharper: Find usage of a Page.aspx

Normally we reference a page using URL (e.g. login.aspx) when we create a form or a navigation menu... and when Re-sharper try to find the usage of the class (e.g. login), it doesn't find the places where I put that URL (e.g. 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 (e.g. 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.

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

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).

Upvotes: 0

Views: 209

Answers (1)

James Johnson
James Johnson

Reputation: 46067

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

Upvotes: 1

Related Questions