Checking ASP.Net Source Code with graspx

In a recent post, I introduced graspx, a tool to check aspx source code files.

Let me show you some usages of this tool (usage requires that you cd to your web development directory):

Check XML compliance

Find all aspx files that are not XML-compliant:

graspx c -ce

Display all ascx files that are not XML-compliant

graspx c -ce *.ascx

Check page titles

To find all aspx files with no set page title, run

graspx l Title | find "Untitled Page"

Check EmptyDataText

If you copy and paste practice code reuse often, you may sometimes overlook changes in texts in the GUI which are not always displayed, such as GridView.EmptyDataText.

To retrieve list of all messages in EmptyDataText, run

graspx l EmptyDataText

To reduce the output to relevant information, namely filename plus text, add the for command (type “help for” for explanation):

for /f "usebackq delims=: tokens=1,5" %i in
  (`graspx l EmptyDataText`) do @echo %i: %j

Check CSS references

These procedures are useful if you want to clean up your CSS definitions:

Find all elements with inline styles:

graspx l style

Find all CSS styles referenced by your ASP.Net files:

graspx l class
graspx l CssClass
graspx l class *.master
graspx | CssClass *.master
graspx l class *.ascx
graspx | CssClass *.ascx

Get sorted results:

(for /f "usebackq delims=: tokens=5" %i in
  (`graspx l CssClass`) do @echo %i) | sort

Unfortunately, Windows sort lacks functionality to return unique results.

To be continued…

2 thoughts on “Checking ASP.Net Source Code with graspx

  1. Pingback: Checking ASP.Net Source Code with graspx, part 2 « devioblog

  2. Pingback: Building Visual Studio Solutions from the Command Line « devioblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.