URL Routing with ASP.NET 4.0

URL Routing with ASP.NET 4.0

Introduction

One thing that has always pinched me is the long URLs that I used to see in several of my projects. Due to better manageability, I used to have several folders, i.e. folder hierarchy for maintainability of my application. But the thing that I didn’t ever like was the full physical path of pages in URLs. There are other ways which allow us to get rid of it like URL rewriting, but I didn’t like that.

We could also have our own custom URL route handler or some third party solution, but they have never been strong enough for an application.

Frankly speaking, one of my clients asked me several times, “Why does this .aspx extension displays in the URL” and also told me that he does not like these long URLs. I used to tell him, this is the normal behavior of ASP.NET application. But we can change it with our own custom solution. However, that will require a little bit of time and also require a lot of testing.

But when Microsoft released ASP.NET MVC 2 with .NET Framework 3.5 SP1, and provided this Routing feature with it, I was very happy and started exploring it. In the meantime, I thought that it should also be provided with ASP.NET, because every time you may not require to follow MVC architecture and also found that MVC has nothing special to do with URL Routing. So I was expecting and waiting for ASP.NET Webform Routing.

Now Microsoft introduced URL Routing with ASP.NET 4.0. URL routing is fully integratedvery powerful andstraightforward.

Prerequisite

  • Visual Studio 2010

What is URL Routing

We access our webapplication using some URL that is normally the physical path of the pages. So URL Routing is a way to provide our own URL in lieu of the physical path of the page. One other way, Routing allows us a way to configure our application to accept a requested URL which actually doesn’t map to physical files. From the security perspective of the application, it’s important because one can easily know the solution structure of the application.

Fig 1.0: URL Routing Processing

Why URL Routing

In 1999, on usability Jakob Nielson wrote on his blog “URL as UI” 6 essential points about URL. These are:

  • A domain name that is easy to remember and easy to spell
  • Short URLs
  • Easy to type URLs
  • URLs that visualize site structure
  • URLs that are “hackable” to allow users to move to higher levels of the information architecture by hacking off the end of the URL
  • Persistent URLs that don’t change

As from all these points, we can see the URLs as a part of user interface and it should be simple and easy. URLs should also made us visualize the structure of our application which might be a security concern for us, etc.

ASP.NET 4.0 provides us the features, taking care of all the points mentioned above.

Also, these URLs helps in SEO (Search engine optimization) and improve the page hits but put in the appropriate keywords.

URL Routing Earlier

Earlier, URL routing was not so easy. For that, we require to have our own custom handler in a way that whenever a URL is requested, our custom route handler class should be invoked, and forward the request to the appropriate requested page or we could have some third party solution. So let’s say if we are going to develop our own customhandler, then what do we need to do.

  1. We define the mapping in Global.asax, which maps a route pattern to route handler class.
  2. We require to develop a Route handler class which actually receives the URL, parses it, stores any route parameters into some location that should be accessible to the requested page and returns the instance of requested page or forwards the request to the HTTPhandler that handles the requested route.
  3. Writing code in the target page in the way so that it can fetch the route parameters and renders the page accordingly.

So you can imagine that it was not a straightforward task. It also requires some considerable amount of effort to develop it.

URL Routing with ASP.NET 4.0

As I already discussed in my introduction section, that ASP.NET 4.0 provides us a simplified and robust way to handle the entire URL routing mechanism. To provide URL routing, ASP.NET is now equipped with myriad classes and a number of methods to provide this feature, which allows to easily decouple the URL with physical files. We just need to use them.

Fig 2.0: ASP.NET 4.0 URL Routing Flow

ASP.NET 4.0 router enables to define any kind of custom routes and we can easily map it to our webform page.

ASP.NET 4.0 also made our life simpler by providing us the feature “Bi- Directional routing” with the help of several components like Route TablePage Routehandler and ExpressionBuilders.

What is Bi-directional Routing

With the help of the Route table, we can not only decode the Routed URL with the Route table and with the help of other methods provided by the ASP.NET 4.0, we also generate the URL with the ASP.NET routing mechanism, which gives us the opportunity, not to hard code the URL at several places, rather it will be dynamically generating the URLs with the help of Routing Definition.

So we just require to change the Route Table on any changes in the URL, and don’t need to change it in several other places throughout the solution.

Fig 3.0: Bi-directional Routing

Components of ASP.NET 4.0 URL Routing

There are two main components of ASP.NET 4.0 URL Routing.

RoutingHandler

This is basically a normal HTTPHandler, which is responsible for looking into all the incoming URL requests, and looking for any Routing definition available for the URL, if yes, then pass the request and data to the corresponding resource.

Expression Builders

Expressions are provided with ASP.NET 4.0 to facilitate Bi-Directional Routing and more. Basically there are two types of ExpressionBuilders.

  1. RouteURLExpressionBuilder: As the name suggests, it provides the syntax which results in the value, i.e., URL based on RouteName and Parameter according to the Route definitions we have.
  2. RouteValueExpressionBuilder: As above, it generates the URL, RouteValueExpressionBuilderprovides a syntax which receives the value from the RouteName and Parameter from RoutedURL.

There are also a few new properties HttpRequest.RequestContext and Page.RouteData which facilitate the availability of the parameters to all resources.

An Example

In this example, I will be displaying the image and name of the book on my web page.

Here, I will be going to an ASP.NET application and will take you step by step to create the application.

Note:

  • I have used VS2010 Beta 2 version for this sample.
  • We have to use the namespace System.Web.Routing in our application to access Routing specific classes and methods.

Step 1

Define the Route in Application_Start of Global.asax. Also include namespace System.Web.Routing.

 Collapse | Copy Code

void Application_Start(object sender, EventArgs e)

{

// Code that runs on application startup

RouteTable.Routes.MapPageRoute(“StoreRoute”,

“BookStore/{Name}”,

“~/Webpages/BookStore/ViewBookDemo.aspx”);

}

Step 2

  1. Now in ViewBookDemo.aspx, I have four links. In the first two, I have hardcoded the URL and in the last, I usedRoutURLExpressionBuilder to generate the URL dynamically. That is known as Bi- Directional routing. This is the one I also liked the most, in several cases, we have had links in our pages that were generally hard coded.
  1. I also have a Label in the page and I set the Text property dynamically with the help of Routing information as above.

Step 3

Here, I fetch the parameter from the Routing Table and set the Image1 URL dynamically.(Include namespaceSystem.Web.Routing):

 Collapse | Copy Code

    //fetching the parameter that is Route table

string name = Page.RouteData.Values[“Name”] as string;

if (name != null)

{

if (name == “CSS”)

{

Image1.ImageUrl = “~/images/css.jpg”;

}

else if (name == “Django”)

{

Image1.ImageUrl = “~/images/django.jpg”;

}

else if (name == “IPhone”)

{

Image1.ImageUrl = “~/images/iphone.jpg”;

}

else if (name == “Linq”)

{

Image1.ImageUrl = “~/images/Linq.jpg”;

}

}

}

To view the entire code, please download the attachment.

Now my solution hierarchy in the demo application is:

Fig 4.0: Solution Explorer

And according to it, my URL should be http://localhost:2039/Webpages/BookStore/ViewBome.aspx?Name=CSS as:

Fig 5.0: Demo Application

Now when a user requests this application, the request is processed as:

Fig 6.0: Request Processing

Feedback and Suggestions

Feedback is the key for me. I would request all of you to share your feedback and give me some suggestions, which would encourage and help me in writing more articles.

References

Bottom of Form

Categories: ASP.NET MVC

Website Testing Techniques

Introduction

First, let’s have a web testing checklist:

  1. Functionality Testing
  2. Usability testing
  3. Interface testing
  4. Compatibility testing
  5. Performance testing
  6. Security testing

1. Functionality Testing

Test for – all the links in web pages, database connection, forms used in the web pages for submitting or getting information from user, cookie testing.

Check all the Links

  • Test the outgoing links from all the pages from specific domain under test
  • Test all internal links
  • Test links jumping on the same pages
  • Test links used to send the email to admin or other users from web pages
  • Test to check if there are any orphan pages
  • Lastly in link checking, check for broken links in all above-mentioned links

Test Forms in all Pages

Forms are the integral part of any web site. Forms are used to get information from users and to keep interaction with them. So what should be checked on these forms?

  • First check all the validations on each field
  • Check for the default values of fields
  • Wrong inputs to the fields in the forms
  • Options to create forms if any, form delete, view or modify the forms

Let’s take an example of the search engine project I am currently working on. In this project, we have advertiser and affiliate signup steps. Each sign up step is different but dependent on other steps. So sign up flow should get executed correctly. There are different field validations like email ids, user financial information validations. All these validations should get checked in manual or automated web testing.

Cookies Testing

Cookies are small files stored on the user machine. These are basically used to maintain the session mainly login sessions. Test the application by enabling or disabling the cookies in your browser options. Test if the cookies are encrypted before writing to user machine. If you are testing the session cookies (i.e., cookies expire after the sessions ends), check for login sessions and user stats after session end. Check effect on application security by deleting the cookies. (I will soon write a separate article on cookie testing.)

Validate Your HTML/CSS

If you are optimizing your site for Search engines, then HTML/CSS validation is very important. Mainly validate the site for HTML syntax errors. Check if site is crawlable to different search engines.

Database Testing

Data consistency is very important in web application. Check for data integrity and errors while you edit, delete, modify the forms or do any DB related functionality.

Check if all the database queries are executing correctly, data is retrieved correctly and also updated correctly. More on database testing could be load on DB, we will address this in web load or performance testing below.

2. Usability Testing

Test for Navigation

Navigation means how the user surfs the web pages, different controls like buttons, boxes or how user uses the links on the pages to surf different pages.

Usability Testing Includes

Web site should be easy to use. Instructions should be provided clearly. Check if the provided instructions are correct meaning whether they satisfy the purpose.

Main menu should be provided on each page. It should be consistent.

Content Checking

Content should be logical and easy to understand. Check for spelling errors. Use of dark colors annoys users and should not be used in site theme. You can follow some standards that are used for web page and content building. These are common accepted standards like I mentioned above about annoying colors, fonts, frames, etc.

Content should be meaningful. All the anchor text links should be working properly. Images should be placed properly with proper sizes.

These are some basic standards that should be followed in web development. Your task is to validate all for UI testing.

Other user information for user help: Like search option, sitemap, help files, etc., sitemap should be present with all the links in web sites with proper tree view of navigation. Check for all links on the sitemap.

“Search in the site” option will help users to find content pages they they are looking for easily and quickly. These are all optional items and if present, should be validated.

3. Interface Testing

The main interfaces are:

  • Web server and application server interface
  • Application server and database server interface

Check if all the interactions between these servers are executed properly. Errors are handled properly. If database or web server returns any error message for any query by application server, then application server should catch and display these error messages appropriately to users. Check what happens if user interrupts any transaction in-between? Check what happens if connection to web server is reset in between?

4. Compatibility Testing

Compatibility of your web site is very important testing aspect. See which compatibility test is to be executed:

  • Browser compatibility
  • Operating system compatibility
  • Mobile browsing
  • Printing options

Browser Compatibility

In my web-testing career, I have experienced this as the most influencing part on web site testing.

Some applications are very dependent on browsers. Different browsers have different configurations and settings that your web page should be compatible with. Your web site coding should be cross browser platform compatible. If you are using JavaScripts or AJAX calls for UI functionality, performing security checks or validations, then give more stress on browser compatibility testing of your web application.

Test web application on different browsers like Internet Explorer, Firefox, Netscape Navigator, AOL, Safari, Opera browsers with different versions.

OS Compatibility

Some functionality in your web application may not be compatible with all operating systems. All new technologies used in web development like graphics designs, interface calls like different APIs may not be available in all Operating Systems.

Test your web application on different operating systems like Windows, Unix, MAC, Linux, Solaris with different OS flavors.

Mobile Browsing

This is the new technology age. So in future, Mobile browsing will rock. Test your web pages on mobile browsers. Compatibility issues may be there on mobile.

Printing Options

If you are giving page-printing options, then make sure fonts, page alignment, page graphics are getting printed properly. Pages should fit to paper size or as per the size mentioned in the printing option.

5. Performance Testing

Web application should sustain to heavy load. Web performance testing should include:

  • Web Load Testing
  • Web Stress Testing

Test application performance on different internet connection speed.

In web load testing, test if many users are accessing or requesting the same page. Can system sustain in peak load times? Site should handle many simultaneous user requests, large input data from users, simultaneous connection to DB, heavy load on specific pages etc.

Stress testing: Generally stress means stretching the system beyond its specification limits. Web stress testing is performed to break the site by giving stress and checked how system reacts to stress and how system recovers from crashes.

Stress is generally given on input fields, login and sign up areas.

In web performance testing web site functionality on different operating systems, different hardware platforms are checked for software, hardware memory leakage errors,

6. Security Testing

Following are some test cases for web security testing:

  • Test by pasting internal URL directly into browser address bar without login. Internal pages should not open.
  • If you are logged in using username and password and browsing internal pages, then try changing URL options directly, i.e., If you are checking some publisher site statistics with publisher site ID= 123. Try directly changing the URL site ID parameter to different site ID which is not related to logged in user. Access should be denied for this user to view others stats.
  • Try some invalid inputs in input fields like login username, password, input text boxes. Check the system reaction on all invalid inputs.
  • Web directories or files should not be accessible directly unless given download option.
  • Test the CAPTCHA for automates scripts logins.
  • Test if SSL is used for security measures. If used, proper message should get displayed when user switches from non-secure http:// pages to secure https:// pages and vice versa.
  • All transactions, error messages, security breach attempts should get logged in log files somewhere on web server.

I think I have addressed all major web testing methods. If I missed out addressing some important web testing aspect, then let me know in the comments below. I will keep on updating the article for latest testing information.

Bottom of Form

Categories: ASP.NET MVC

HTML Quick List

<!– ••• –>
<!DOCTYPE …>
<A …> Anchor HREF: URL you are linking to
NAME: name a section of the page
TARGET = “_blank” | “_parent” | “_self” | “_top” | window name
which window the document should go in
TITLE: suggested title for the document to be opened
onClick: script to run when the user clicks on this anchor
onMouseOver: when the mouse is over the link
onMouseOut: when the mouse is no longer over the link
ACCESSKEY
<ADDRESS>
<APP …>
<APPLET …> CODE: the applet to run
CODEBASE: path to the applet class
WIDTH: width of the applet
HEIGHT: height of the applet
ALIGN = LEFT | RIGHT | TOP | MIDDLE | BOTTOM | BASELINE
alignment of applet to surrounding text
VSPACE: vertical space between applet and surrounding text
HSPACE: horizontal space between applet and surrounding text
BORDER: empty space surrounding the applet
NAME: name of applet for reference by other applets
ARCHIVE: a compressed collection of applet components
MAYSCRIPT: If Java can use JavaScript
<AREA …> HREF: URL you are linking to
ALT: alternate text if the image isn’t displayed
SHAPE = RECT | CIRCLE | POLY | DEFAULT
what shape is this area?
COORDS: coordinates for the link area shape
TITLE: Short description of the area
TARGET: what frame to go to
NOHREF: this area is not a link
onClick: script action when the user clicks this area
onMouseOver
onMouseOut
<B> Bold
<BASE …> Base Address HREF: default address for hypertext links
TARGET = “_blank” | “_parent” | “_self” | “_top” | frame name
default window for linked documents
<BASEFONT …> SIZE
COLOR
FACE
<BGSOUND …> SRC: URL of the sound
LOOP = INFINITE | number of loops
how many times to play the sound
<BIG>
<BLINK>
<BLOCKQUOTE …> Block Quote
<BODY …> BGCOLOR: background color of the page
BACKGROUND: background picture for the page
TEXT: color of the text on the page
LINK: color of links that haven’t been followed yet
VLINK: color of links that have been followed
ALINK: color of links while you are clicking on them
BGPROPERTIES = FIXED
if the background image should not scroll
TOPMARGIN: size of top and bottom margins
LEFTMARGIN: size of left and right margins
MARGINHEIGHT: size of top and bottom margins
MARGINWIDTH: size of left and right margins
onLoad: Script to run once the page is fully loaded
onUnload
onFocus
onBlur
STYLESRC: MS FrontPage extension
SCROLL = YES | NO
If the document should have a scroll bar
<BR …> Line Break CLEAR = LEFT | RIGHT | ALL | BOTH
go past a picture or other object
<BUTTON …> TYPE = BUTTON | SUBMIT | RESET
what type of button is this
onClick: script to run when the user clicks here
NAME: name of this button element
VALUE: the value sent with the form
DISABLED: disable this button
ACCESSKEY: shortcut key for this button
TABINDEX: tab order
<CAPTION …> ALIGN = TOP | BOTTOM | LEFT | RIGHT
alignment of caption to table
VALIGN = TOP | BOTTOM
if caption should be above or below table
<CENTER …>
<CITE> Citation
<CODE>
<COL …> Column SPAN: how many columns this affects
ALIGN = LEFT | CENTER | RIGHT | JUSTIFY
horizontal alignment
WIDTH: width of the column
BGCOLOR: background color of the column
<COLGROUP …> Column Group SPAN: how many columns this affects
ALIGN: alignment of cell contents
WIDTH: Width of the column group
<COMMENT>
<DD> Definition Description
<DEL> Deleted
<DFN> Definition
<DIR …> Directory List
<DIV …> ALIGN = LEFT | CENTER | RIGHT | JUSTIFY
text alignment
<DL …> Definition List COMPACT: take up less space
<DT> Definition Term
<EM> Emphasis
<EMBED …> SRC: URL of resource to be embedded
WIDTH: width of area in which to show resource
HEIGHT: height of area in which to show resource
ALIGN = ABSBOTTOM | ABSMIDDLE | MIDDLE | TEXTTOP | RIGHT | LEFT | BASELINE | CENTER | BOTTOM | TOP
how text should flow around the picture
NAME: name of the embedded object
PLUGINSPAGE: where to get the plugin software
PLUGINURL: where to get the JAR archive for automatic installation
HIDDEN = FALSE | TRUE
if the object is visible or not
HREF: make this object a link
TARGET: frame to link to
AUTOSTART = TRUE | FALSE
if the sound/movie should start automatically
LOOP = TRUE | FALSE | # of loops
how many times to play the sound/movie
PLAYCOUNT: how many times to play the sound/movie
VOLUME: how loud to play the sound
CONTROLS = VOLUMELEVER | STOPBUTTON | PAUSEBUTTON | PLAYBUTTON | SMALLCONSOLE | CONSOLE
which sound control to display
CONTROLLER = TRUE | FALSE
if controls should be displayed
MASTERSOUND: indicates the object in a sound group with the sound to use
STARTTIME: how far into the sound to start and stop
ENDTIME: when to finish playing
<FIELDSET>
<FONT …> SIZE: size of the font
COLOR: color of the text
FACE: set the typestyle for text
POINT-SIZE
WEIGHT
<FORM …> ACTION: URL of the CGI program
METHOD = GET | POST
how to transfer the data to the CGI
NAME: name of this form
ENCTYPE = “multipart/form-data” | “application/x-www-form-urlencoded” | “text/plain”
what type of form this is
TARGET = “_blank” | “_parent” | “_self” | “_top” | frame name
what frames to put the results in
onSubmit: script to run before the form is submitted
onReset: script to run before the form is reset
<FRAME …> SRC: what file to put in the frame
NAME: the name of the frame
SCROLLING = YES | NO | AUTO
should the frame have a scrollbar?
NORESIZE: don’t let the user make the frame bigger or smaller
FRAMEBORDER = YES | 1 | NO | 0
should this frame have a border?
BORDERCOLOR: color of the surrounding border
MARGINWIDTH: the internal left and right margins for the frame
MARGINHEIGHT: the internal top and bottom margins for the frame
<FRAMESET …> COLS: how many cols in the frameset
ROWS: how many rows in the frameset
FRAMEBORDER = YES | 1 | NO | 0
if the frames should have borders
FRAMESPACING: space between the frames
BORDER: space between frames
BORDERCOLOR: color of frame borders
<H# …> Headers<H1 …>, <H2 …>, <H3 …>,
<H4 …>,
<H5 …>,
<H6 …>
ALIGN = LEFT | RIGHT | CENTER | JUSTIFY
alignment
<HEAD>
<HR …> Horizontal Rule NOSHADE: don’t use shadow effect
SIZE: height
WIDTH: horizontal width of the line
ALIGN = LEFT | RIGHT | CENTER
horizontal alignment of the line
COLOR: color of the line
<HTML>
<HTMLPLUS …>
<HYPE>
<I> Italics
<IFRAME …> Inline Frame SRC: URL of the document to go in the frame
HEIGHT: height of the inline frame
WIDTH: width of the inline frame
NAME: name of this inline frame
LONGDESC: URL of a long description of the contents of the frame
FRAMEBORDER = 1 | 0
if the frame should have a border around it
MARGINWIDTH: internal left/right margin for the frame
MARGINHEIGHT: internal top/bottom margin for the frame
SCROLLING = YES | NO | AUTO
if the frame should have scroll bars
ALIGN = LEFT | RIGHT | TOP | TEXTTOP | MIDDLE | ABSMIDDLE | CENTER | BOTTOM | ABSBOTTOM | BASELINE
alignment of the frame object to text around it
VSPACE: space above and below the frame
HSPACE: space to the left and right of the frame
<IMG …> Image SRC: where to get the picture
ALT: text to show if you don’t show the picture
NAME
LONGDESC: URL of a long description of the image
WIDTH: how wide is the picture
HEIGHT: how tall is the picture
ALIGN = LEFT | RIGHT | TOP | TEXTTOP | MIDDLE | ABSMIDDLE | BOTTOM | ABSBOTTOM | BASELINE
how text should flow around the picture
BORDER: border around the picture
HSPACE: horizontal distance between the picture and the text
VSPACE: vertical distance between the picture and the text
ISMAP: is this a clickable map?
USEMAP: name of the map definition
LOWSRC: a version of the picture that isn’t such a big file
NATURALSIZEFLAG: meaningless
NOSAVE: meaningless
DYNSRC: play a movie file
CONTROLS: show the buttons which control the movie
LOOP = INFINITE | -1 | # of loops
how many times to loop the movie
START = FILEOPEN | MOUSEOVER
when to start playing the movie
onLoad: script to runs after the image is downloaded
SUPPRESS = TRUE | FALSE
Don’t show icons of images that haven’t downloaded yet
<INPUT …> TYPE = TEXT | CHECKBOX | RADIO | PASSWORD | HIDDEN | SUBMIT | RESET | BUTTON | FILE | IMAGE
what type of field
NAME: name of this form field
VALUE: initial or only value of this field
SIZE: how wide the text field should be
MAXLENGTH: maximum number of characters
CHECKED: check this checkbox or radio button
BORDER: border around image
SRC: URL of image
ALT: text to show if you don’t show the picture
LOWSRC: a version of the picture that isn’t such a big file
WIDTH: width of image
HEIGHT: height of image
ALIGN = LEFT | RIGHT | TOP | TEXTTOP | MIDDLE | ABSMIDDLE | CENTER | BOTTOM | ABSBOTTOM | BASELINE
how text should flow around the picture
VSPACE: vertical distance between the picture and the text
HSPACE: horizontal distance between the picture and the text
READONLY: the value of this field cannot be changed
DISABLED: don’t let the user do anything with this field
ACCESSKEY
TABINDEX: tab order
LANGUAGE = “JavaScript” | “JavaScript1.1” | “JSCRIPT” | “VBScript” | “VBS” | other language
scripting language to use
onClick: when the user clicks here
onChange: when this field is changed
onFocus: when this field gets the focus
onBlur: when this field loses the focus
onKeyPress: script to run when a key is pressed
onKeyUp: script for when a key goes up while the field has the focus
onKeyDown: script for when a key goes down while the field has the focus
AUTOCOMPLETE = ON | OFF
If the browser should use autocompletion for the field
<INS> Inserted<DEL>
<ISINDEX …> PROMPT: prompt string to show before the text entry area
ACTION: the CGI to call
<KBD> Keyboard
<LABEL …> FOR: form element for which this is a label
<LEGEND …> ALIGN = RIGHT | CENTER | LEFT
<LI …> List Item TYPE = DISC | CIRCLE | SQUARE | 1 | A | a | I | i
type of bullet or numeral
VALUE: where to continue counting
<LINK …> REL: relationship to this page
REV: reverse relationship to this page
HREF: URL of related document
TITLE: suggested title
MEDIA = SCREEN | PRINT | PROJECTION | AURAL | BRAILLE | ALL | other media
What media type the link applies to
TYPE: MIME type of linked resource
<LISTING>
<MAP …> NAME: name of this map
<MARQUEE …> WIDTH: how wide the marquee is
HEIGHT: how tall the marquee is
DIRECTION = LEFT | RIGHT
which direction the marquee should scroll
BEHAVIOR = SCROLL | SLIDE | ALTERNATE
what type of scrolling
SCROLLDELAY: how long to delay between each jump
SCROLLAMOUNT: how far to jump
LOOP = INFINITE | number of loops
how many times to loop
BGCOLOR: background color
HSPACE: horizontal space around the marquee
VSPACE: vertical space around the marquee
<MENU …>
<META …> NAME = KEYWORDS | DESCRIPTION | REFRESH | many others
The pupose of this META tag
HTTP-EQUIV: Name of the pretend HTTP header
CONTENT: Metainformation content
<MULTICOL …> COLS: how many columns
GUTTER: space between columns
WIDTH: width of a single column
<NOBR> No Break
<NOEMBED>
<NOFRAMES>
<NOSCRIPT>
<OL …> Ordered List TYPE = 1 | A | a | I | i
type of numerals
START: where to start counting
<OPTION …> VALUE: what’s the value if this option is chosen
SELECTED: this option is selected by default
<P …> Paragraph ALIGN = LEFT | CENTER | RIGHT | JUSTIFY
alignment of text within the paragraph
CLEAR = LEFT | RIGHT | ALL | BOTH
move past picture and other objects
<PARAM …> Parameter NAME: name of the parameter
VALUE: value of the parameter
<PLAINTEXT>
<PRE …> Preformatted Text
<S> Strikeout
<SAMP> Sample
<SCRIPT …> TYPE = “text/javascript” | “text/vbscript” | other scripting language
Which scripting language to use
SRC: External source for script
DEFER: Continue loading page while downloading script
LANGUAGE = JAVASCRIPT | LIVESCRIPT | VBSCRIPT | other
Deprecated indicator of language
FOR: object for which this script is an event handler
EVENT: the event this script handles
<SELECT …> NAME: name of this form element
MULTIPLE: allow more than one choice
SIZE: how many options to show
READONLY: don’t let the user change the value of this field
DISABLED: don’t let the user do anything with this field
LANGUAGE = “JavaScript” | “JavaScript1.1” | “VBScript” | other language
scripting language to use
onChange: what to do when a new option is selected
TABINDEX: tab order
onFocus: script to run when this field gets the focus
onBlur: script to run when this field loses the focus
<SMALL>
<SOUND …>
<SPACER …> TYPE = HORIZONTAL | VERTICAL | BLOCK
what type of space is this
ALIGN = LEFT | RIGHT
align left or right
SIZE: how tall or wide
WIDTH: how wide
HEIGHT: how tall
<SPAN …>
<STRIKE> Strikeout<S>
<STRONG>
<STYLE …> TYPE: style language
MEDIA: type of media this syle applies to
<SUB> Subscript
<SUP> Superscript
<TABLE …> BORDER: size of border around the table
CELLPADDING: space between the edge of a cell and the contents
CELLSPACING: space between cells
WIDTH: width of the table as a whole
BGCOLOR: color of the background
BACKGROUND: picture to use as background
ALIGN = LEFT | RIGHT
alignment of table to surrounding text
HSPACE: horizontal space between table and surrounding text
VSPACE: vertical space between table and surrounding text
HEIGHT: height of the table as a whole
FRAME = VOID | BOX | BORDER | ABOVE | BELOW | LHS | RHS | HSIDES | VSIDES
parts of outside border that are visible
RULES = NONE | ALL | COLS | ROWS | GROUPS
if there should be internal borders
BORDERCOLOR: color of border around the table
BORDERCOLORLIGHT: color of “light” part of border around the table
BORDERCOLORDARK: color of “dark” part of border around the table
SUMMARY: Summary of the purpose of the table
<TBODY …> Table Body Section
<TD …> Table Data ALIGN = LEFT | CENTER | MIDDLE | RIGHT
horizontal alignment of cell contents
VALIGN = TOP | MIDDLE | CENTER | BOTTOM | BASELINE
vertical alignment of cell contents
WIDTH: width of cell
HEIGHT: height of cell
COLSPAN: number of columns to cover
ROWSPAN: number of rows to cover
NOWRAP: don’t word wrap
BGCOLOR: color of the background
BORDERCOLOR: color of border around the table
BORDERCOLORDARK: color of “dark” part of border around the table
BORDERCOLORLIGHT: color of “light” part of border around the table
BACKGROUND: picture to use as background
<TEXTAREA …> NAME: name of this form field
COLS: how many characters wide
ROWS: how many rows
WRAP = SOFT | HARD | OFF
how to wrap the text
READONLY: don’t let the user change the contents of the field
DISABLED: don’t let the user do anything with this field
TABINDEX: tab order
LANGUAGE = “JavaScript” | “JavaScript1.1” | “VBScript” | other language
scripting language
onChange: Script to run when the user has changed the textarea
onKeyPress: script to run when a key is pressed
<TFOOT …> Table Footer Section
<TH …> Table Header
<THEAD …> Table Header Section<TBODY …>, <TFOOT …>
<TITLE>
<TR …> Table Row ALIGN = LEFT | CENTER | RIGHT
horizontal alignment of cell contents
HALIGN = LEFT | CENTER | RIGHT
VALIGN = TOP | MIDDLE | BOTTOM | BASELINE
vertical alignment of cell contents
BGCOLOR: background color
BACKGROUND: background image
BORDERCOLOR: color of border around each cell
BORDERCOLORLIGHT: color of “light” part of border around each cell
BORDERCOLORDARK: color of “dark” part of border around each cell
<TT> Teletype
<U> Underline
<UL …> Unordered List TYPE = DISC | CIRCLE | SQUARE
type of bullets
<VAR> Variable
<WBR>
<XMP>


Database Coding Standards and Guidelines

February 22, 2010 1 comment

Database Coding Standards and Guidelines

1. ANSI SQL 92 standards have to be followed for writing queries.

2. Do not put order by clause in the query unless required.

3. Do not encapsulate readonly database operations in transactions.

4. Use a stored procedure with output parameters instead of single record SELECT statements when retrieving one row of data.

5. Stored procedure execution is fast when we pass parameters by position (the order in which the parameters are declared in the stored procedure) rather then by name.

6. After each data modification statement inside a transaction, check for an error by testing the global variable @@ERROR

7. Verify the row count when performing DELETE operation

8. Use RETURN statement in stored procedures to help the calling program know whether the procedure worked properly.

9. Key words should be capital. For example; SELECT, UPDATE, DELETE, INSERT, FROM, AND WHERE, etc.

10. Do not use “SELECT * FROM” type of query. If all the columns of the table are to be selected, list all columns in the SELECT in same order as they appear in the table definition.

11. While writing a query as a string, do not put any space after single quote (‘). There should be a single space between every two words. There should not be a space between the last word and the concluding single quote (‘).

12. Where multiple columns are selected, there should be a single space after every ‘,’ between two columns.

13. All the major keywords should come on the new lines

14. The number of columns in a SELECT statement should not be more than 6. The line separator should be placed in this case after the (,) of the last column of this line and a single space.

15. For any new line separator, the separator should come after a single space after the last word of the line.

16. Place a tab after each key word on a new line.

17. Use transactions when you are involving with multiple DML statements inside a stored procedure. This ensures all or non principal.

February 22, 2010 Leave a comment

ASP.NET Coding Standards and Guidelines

1. Prefix user control names with “uc”

2. The rest of the user control name should be in Pascal Casing (Ex. ucMyUserControl)

3. Do not use session variables throughout the code. Use session variables only within the classes and expose methods to access the value stored in the session variables.

4. Do not store large objects in session, it may consume lot of server memory depending on the number of users.

5. Always use style sheet to control the look and feel of the pages.

6. Categories data and store it in predefine folder depending on its working.(e.g.- store all images, sound, video files in media or image folder)

Control Name Abbreviations/ Prefixes Remarks
Form wf,frm
Textbox Txt
TextArea Txa
Checkbox Chk
Check Box List Chklst chklstCurrency
Label Lbl
Hidden Elements Hdn
Combo Box / Drop Down Cbo
Button cmd,btn
Submit Button smt
Reset Button rst
Link Button lbtn lbtnSave
Image Button ibtn ibtnExit
Password Field pwd
Radio Button opt
Radio Button List optlst optlstSelect
List Box lst
Frame fra
Image img
Pointer ptr
Panel pan,pnl pnlBackground
Place Holder plh
Calendar cal
Ad Rotator adr
Table tbl tblAppointments
Range Validator rav,rgv
Regular Expression Validator rev
Regular Field Validator rfv
Compare Validator cmv
Custom Validator cuv,csv
Validation Summary vsm
XML Xml XmlDataFile
File Field Fle
Literal Lit
Arraylist Al
Hyperlink hyp
DataGrid dtg,dgr
DataList dtl
Repeater rpt rptReport
Flow Layout Panel flp
Grid Layout Panel glp
Horizontal Rule hr
Crystal Report Viewer crv,crvr crvReport

Visual Studio 2010 & .Net Framework 4.0

February 22, 2010 Leave a comment

I found an Article about Visual Studio Team System (VSTS) 2010. I was amazing to see the Microsoft Announcement. Because till now most of the developers (me also) dint use the Visual Studio 2008. And don’t know much about Framework 3.5. But being a programmer we have to update our knowledge with current technology. So I decided to start VS2008 as soon as possible….!

So..Here I am mentioning some details about VS2010. Microsoft Announce that this Framework as .Net Framework 4.0 and it code name is “Rosario”. The main features are collaborative development, modeling, and debugging.

In This Framework Major pillars are..

  • Democratizing Application Lifecycle Management(ALM)
  • Enabling emerging trends
  • Inspiring developer delight
  • Riding the next generation platform wave
  • Breakthrough Departmental Applications.

Design Pattern

February 19, 2010 Leave a comment

Design patterns are recurring solutions to software design problems you find again and again in real-world application development. Patterns are about design and interaction of objects, as well as providing a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges.

The Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral. Here you will find information on these important patterns.

To give you a head start, the C# source code is provided in 2 forms: ‘structural’ and ‘real-world’. Structural code uses type names as defined in the pattern definition and UML diagrams. Real-world code provides real-world programming situations where you may use these patterns.

A third form, ‘.NET optimized’ demonstrates design patterns that exploit built-in .NET 2.0, 3.0, and 3.5 features, such as, generics, attributes, delegates, object and collection initializers, automatic properties, and reflection. These and much more are available in our Design Pattern Framework 3.5TM. See our Singleton page for a .NET 3.5 Optimized code sample.

Creational Patterns
Abstract Factory Creates an instance of several families of classes
Builder Separates object construction from its representation
Factory Method Creates an instance of several derived classes
Prototype A fully initialized instance to be copied or cloned
Singleton A class of which only a single instance can exist
Structural Patterns
Adapter Match interfaces of different classes
Bridge Separates an object’s interface from its implementation
Composite A tree structure of simple and composite objects
Decorator Add responsibilities to objects dynamically
Facade A single class that represents an entire subsystem
Flyweight A fine-grained instance used for efficient sharing
Proxy An object representing another object
Behavioral Patterns
Chain of Resp. A way of passing a request between a chain of objects
Command Encapsulate a command request as an object
Interpreter A way to include language elements in a program
Iterator Sequentially access the elements of a collection
Mediator Defines simplified communication between classes
Memento Capture and restore an object’s internal state
Observer A way of notifying change to a number of classes
State Alter an object’s behavior when its state changes
Strategy Encapsulates an algorithm inside a class
Template Method Defer the exact steps of an algorithm to a subclass
Visitor Defines a new operation to a class without change
Categories: Design Pattern

Hello world!

February 16, 2010 1 comment

Welcome to BhaskarChar.WordPress.com. This is your first post. Edit or delete it and start blogging!

Categories: Uncategorized