Monday, September 10, 2012

ASP.NET Difference FAQs-4


1.Difference between HTTP and HTTPS
S.NoHTTPHTTPS
1URL begins with “http://" in case of HTTPURL begins with “https://” in case of HTTPS.
2HTTP is unsecuredHTTPS is secured.
3HTTP uses port 80 for communicationHTTPS uses port 443 for communication.
4HTTP operates at Application LayerHTTPS operates at Transport Layer.
5No encryption is there in HTTPHTTPS uses encryption.
6No certificates required in HTTP certificates required in HTTPS.
7Most internet forums will probably fall into this category. Because these are open discussion forums, secured access is generally not required 
HTTPS should be used in Banking Websites, Payment Gateway, Shopping Websites, Login Pages, Emails (Gmail offers HTTPS by default in Chrome browser) and Corporate Sector Websites. For example:

PayPal: https://www.paypal.com
Google AdSense: https://www.google.com/adsense/

2.Difference between GET and POST methods
S.NoGETPOST
1Post Mechanism:

GET request is sent via URL.
Post Mechanism:

Post request is sent via HTTP request body or we can say internally.
2Form Default Method:


GET request is the default method. 
Form Default Method:


We have to specify POST method within form tag like
3
Security:

Since GET request is sent via URL, so that we can not use this method for sensitive data.
Security:

Since Post request encapsulated name pair values in HTTP request body, so that we can submit sensitive data through POST method. 
4
Length:

GET request has a limitation on its length. The good practice is never allow more than 255 characters. 
Length:

POST request has no major limitation. 
5
Caching or Bookmarking:

GET request will be better for caching and bookmarking. 
Caching or Bookmarking:

POST request is not better for caching and bookmarking. 
6
SEO:

GET request is SEO friendly. 
SEO:

POST request is not SEO friendly. 
7
Data Type:

GET request always submits data as TEXT. 
Data Type:

POST request has no restriction. 
8
Best Example:

SEARCH is the best example for GET request. 
Best Example:

LOGIN is the best example for POST request. 
9
HTTP Request Message Format:

1 GET /path/file.html?SearchText=Interview_Question HTTP/1.0
2 From: umarali1981@gmail.com
3 User-Agent: HTTPTool/1.0
4 [blank line here]
HTTP Request Message Format:

1 POST /path/script.cgi HTTP/1.0
2 From: umarali1981@gmail.com
3 User-Agent: HTTPTool/1.0
4 Content-Type: application/x-www-form-urlencoded
5 Content-Length: 8
6
7 Code=132
Some comments on the limit on QueryString / GET / URL parameters Length:

1. 255 bytes length is fine, because some older browser may not support more than that.
2. Opera supports ~4050 characters.
3. IE 4.0+ supports exactly 2083 characters.
4. Netscape 3 -> 4.78 support up to 8192 characters.
5. There is no limit on the number of parameters on a URL, but only on the length.
6. The number of characters will be significantly reduced if we have special characters like spaces that need to be URLEncoded (e.g. converted to the '%20').
7. If we are closer to the length limit better use POST method instead of GET method.

3.Difference between User Controls and Master Pages
S.NoUser ControlsMaster Pages
1
Its extension is .ascx.
Its extension is .Master.
2Code file: .ascx.cs or .ascx.vbcode file: .master.cs or .master.vb extension
3A page can have more than one User Controls.Only one master page can be assigned to a web page
4It does not contain Contentplaceholder and this makes it somewhat difficult in providing proper layout and alignment for large designs. It contains ContentPlaceHolder.
5Suitable for small designs(Ex: logout button on every .aspx page.) More suitable for large designs(ex: defining the complete layout of .aspx page) 
6Register Tag is added when we drag and drop a user control onto the .aspx page. MasterPageFile attribute is added in the Page directive of the .aspx page when a Master Page is referenced in .aspx page.
7Can be attached dynamically using LoadControl method.PreInit event is not mandatory in their case for dynamic attachment. Can be referenced using Web.Config file also or dynamically by writing code in PreInit event. 
4.Difference between Build and Rebuild
S.NoBuildRebuild
1A build compiles only the files and projects that have changed.A rebuild rebuilds all projects and files in the solution irrelevant of whether they have changed or not.
2Build does not updates the xml-documentation filesRebuild updates the xml-documentation files
Note: Sometimes,rebuild is necessary to make the build successful. Because, Rebuild cleans Solution to delete any intermediate and output files, leaving only the project and component files, from which new instances of the intermediate and output files can then be built. 

5.Difference between generic handler and http handler
S.NoGeneric HandlerHttp Handler
1Generic handler has a handler which can be accessed by url with .ashx extensionhttp handler is required to be configured in web.config against extension in web.config.It does not have any extension
2Typical example of generic handler are creating thumbnails of imagesFor http handler, page handler which serves .aspx extension request and give response.

No comments:

Post a Comment