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 Responses to Checking ASP.Net Source Code with graspx

  1. […] ASP.Net Source Code with graspx, part 2 In yesterday’s post about graspx, I demonstrated some usages of the tool that I originally had not thought of, and it soon turned […]

  2. […] check ASP.Net code for XHTML compliance and other criteria using […]

Leave a Reply

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

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

Google+ photo

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

Twitter picture

You are commenting using your Twitter 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.

%d bloggers like this: