Saturday, February 19, 2011

ASP .Net Web Handlers




ASP .Net Generic Handlers

Generic handlers are also called as web handlers. Just as ASPX files can be compiled on the fly (just-in-time), so can handlers. Generic handlers have an extension of ASHX. They contain classes that fully implement IHttpHandler. They're convenient in the same way ASPX files are convenient. You simply surf to them and they're compiled automatically.
Now you would probably have a question in your mind that “why should I use a generic handlers when I can do same thing using web service? “ Now if you know web service needs a consumer event or page to consume its output but in case of Generic Handler you do not need a consumer service. You just can browse through the page where IHttpHandler will do the rest of the work for you or maybe you are in a situation where you need output from something without calling any function, in such scenario web handlers are very handy!
So suppose you want to start using a web handler you can learn to use the same thing from here:
My point is to help people know things as easily as possible so I use copy paste since everything is available in internet! Ctrl+C and Ctrl+V the most prominent tool!
My main reason to come across Web handlers is due to auto complete feature in my project where I was not allowed to use Ajax since I work in a domain which is mainly linked to banking sector, where security and machine speed is considered at high end! In short there are lot of bankers who are very high profiled and they don’t have high configuration machine and they have requirement of security and high functional application with less trouble. So I was enforced to use Jquery.
Ah!! I was at auto complete. Now you must have seen in www.google.com when you type something you get the rest of the things coming up in text box! Ya that is auto complete. Now this one I got it from some site which seems to be worthy for me http://www.aspsnippets.com/Articles/Using-jQuery-AutoComplete-Plugin-in-ASP.Net.aspx try it out!
So Happy Learning!

Sunday, January 16, 2011

How to develop an application from the Scratch?

Pre-requisite:

  1. You should know to copy paste (Ctrl+C and Ctrl+V). This helps to increase your speed since there is no point in reinventing the wheels.
  2. You should know OOPS .If you don't know OOPS refer to this section before proceeding further (http://www.codeproject.com/KB/architecture/OOP_Concepts_and_manymore.aspx). Now you must be knowing basics of OOPS and how to apply it.
  3. Once you are done with OOPS you should know what is Three-Tier Architecture? If you don't know what is Three-Tier Architecture you can refer to this link http://www.codeproject.com/KB/architecture/three_tier_architecture.aspx .In today's world all application is build in Three-Tier and N-Tier architecture. So following this structure is most important since it reduces programming complexity and redundant coding as well as helps to maintain integrity and consistency.
  4. Now if you want to Most Valued Professional then you should follow a Coding Standard. I have chosen a best coding standard specified by dotnetspider.com http://www.dotnetspider.com/tutorials/CodingStandards.doc here is it!
  5. You must have noticed by this time that I am copy pasting most of the contents and links from most of the sites since this is available easily. So without explaining itself you should know how to search using search engine.
  6. You should know how to create a database either in Ms Access, Ms SQL Server or Oracle.
  7. You should have good knowledge of programming either .net or free sources such as Java.
  8. As well as you should know how to use IDE such as Visual Studio or Eclipse or Net Beans.

Application Development

  1. This is the simplest phase of a project. Once you have done with the Pre-requisite you would be having good knowledge about OOPS and programming so in no time or with less time you will be able to make an Application.
  2. The first and most important thing you need to know is what you are going to develop. You should have a proper idea in your mind about how thing should flow.
  3. The other important part if you are developing an application for a client you should cull out entire proper requirement from your client so that you can develop application efficiently if you have not done the same in Software Engineering Phase otherwise simply ignores this.
  4. Now you must choose a language to use during software development. For my flexibility I am choosing C# .net so that I get most of the content easily available in internet as most of the developer stick with this. Remember Copy Paste!
  5. Now you should make
    1. Database (Ms Access, SQL Server or Oracle)
    2. DAL (Data Access Layer)
    3. BAL (Business Access Layer) or BLL (Business Logic Layer)
    4. UI (User Interface)
    5. You can follow the same as shown in this sample project http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx. Just follow this structure you will be able to reach proper end. Now in this DAL should be made first then BAL or BLL then UI. As per the sequence.
  6. I hope you have used proper coding standards! Now your application would be able to run at most of the condition. Now slowly and slowly you can enhance your application if you have used proper coding standards as I have mentioned.

Code Enhancement:

  1. When you go for a bigger application you should always make sure that you should not use stored procedure just to avoid SQL injection. Instead you can validate the same with the help of replace ' with '' and trim.
    For Eg.:

    String QueryString(String str)

    {

    Return Str.Replace("'","''").trim();

    }

    http://www.4guysfromrolla.com/webtech/061902-1.shtml as shown in this link you can make a Common.cs file (in case you are choosing C#) containing such validations in DAL.
  2. Always remember you should not mix up programming logic with database logic. Always keep them at there on place.
There are several such tips for development which I will be explaining in my coming articles.