About Me

My photo
Chennai, TamilNadu, India
Thank you.. Viewers wishing you all the best
Powered By Blogger

Difference


ViewState in Web Forms was serializing form data into a hidden, encrypted field in the form, so data could be re-bound on the postback.
ViewBag/ViewData is a dictionary where you can "stuff" data into. For example, you might add to it in your Controller, then access it in your View. The data is dynamic which makes it difficult to work with the data. ViewBag doesn't get sent to the client, it's part of the MVC (server pipeline)

Diffrence Between WebSite and WebApplication


Web Site
1. We can code one page in C# and one page in vb.net (Multiple programming languages allowed).
2. We cannot call (access) public functions from one page to other page.
3. Utility classes / functions must be placed in a special ASP.NET folder (the App_Code folder)
4. Web Sites do not have a .csproj/.vbproj file that manages the project (the folder that contains the site becomes the project root).
5. In the Web Site project, each file that you exclude is renamed with an exclude
keyword in the filename.
6. Explicit namespaces are not added to pages, controls, and classes by default, but you can add them manually.


• Deployment Web Site

Web Site
1. It has its code in a special App_Code directory and it's compiled into several DLLs (assemblies) at runtime.
2. No need to recompile the site before deployment. 
3. We need to deploy both .aspx file and code behind file. 
4. Small changes to the site do not require a full re-deployment. (We can upload the code file that was changed)

Web Application
1. Only one programming language allowed per project (Need to decide on programming language when starting project). 
2. We can access public functions from one page to other page.
3. Utility classes / function can be placed anywhere in the applications folder structure. 
4. Web Applications are treated like other .NET projects and are managed by a project file (.csproj or .vbproj) . 
5. One nice feature of the Web Application project is it's much easier to exclude files from the project view.
6. Explicit namespaces are added to pages, controls, and classes by default.



Deployment  Web Application
1. web application is precompiled into one single DLL.
2. Site has to be pre-compiled before deployment .
3. Deploy only .aspx page, but not associated code file (the pre-compiled dll will be uploaded) .
4. Even small changes require a full re-compile of the entire site(i.e. if the code for a single page changes the whole site must be compiled) (It requires careful planning to ensure new bugs aren't introduced to the production site when uploading bug fixes or other changes.)


Difference between ASP.NET 3.5 and ASP.NET 4.0
ASP.NET 3.5:

1. Whether Client data can be directly accessed ?
In ASP.NET 3.5, the data from the client side cannot be directly accessed. The client side data can only be accessed using script manager’s Page methods,
interface named ICallbackEventHandler or by using the component XMLHttpHandler.

2. Whether we can set MetaTags (Keywords,Description) in the Page Directive?
In ASP.NET 3.5, two meta tags can be used, one with name as keywords and other with name as description to record the keywords and description for SEO purpose.




3.Whether ViewState can be applied at the Control level ?
ASP.NET 3.5 EnableViewState property cannot be used to apply ViewState at the Control level.It is mainly used at the page level.Its default value is True and its acceptable values ae True and False.

4. How ASP.NET 3.5 identifies ClientID ?
In ASP.NET 3.5, ClientId property has to be used to find the dynamically generated client id.

5.Whether permanent redirection is possible or not ?
There is no RedirectPermanent() method available in ASP.NET 3.5.
Redirect method is less useful than the RedirectPermanent method. It will cause search engine results to be less current, and this can also impact performance because visitors will not be accessing the best URL. Redirect may be most useful for login pages or more complex situations.

6. Output Caching Enhancement:
OutPut Cache in ASP.Net 3.5 has a limitation - generated content always has to be stored in memory, and on servers that are experiencing heavy traffic, the memory consumed by output caching can compete with memory demands from other portions of a Web application.

7. QueryExtender Control for filtering the data returned by EntityDataSource and LinqDataSource controls:
There is no QueryExtender control available in ASP.NET 3.5 to filter the data returned by DataSource Controls( EntityDataSource and LinqDataSource).It has to explicitly use 'Where clause' in the data source.

ASP.NET 4.0:

1.Whether Client data can be directly accessed ?
In ASP.NET 4, the data from the client side can be directly accessed using client data view and client data context objects.

Following methods are available in ASP.NET 4.0 to access Client data directly,
1) Client data controls
2) Client templates
3) Client data context

2. Whether we can set MetaTags (Keywords,Description) in the Page Directive?
The meta keywords and meta
description is really useful for SEO
optimization of the web page. In
ASP.NET 4, the keywords and
description can be included as part of page directive itself.

< %@ Page Language="C#" CodeFile="Default.aspx.cs"
Inherits="_Default"
Keywords="Keyword1,Key2,Key3,etc"
Description="description" %>

3.Whether ViewState can be applied at the Control level ?
In ASP.NET 4, ViewState mechanism is improved to set ViewState at the Contol level besides at the page level set by EnableViewState property in ASP.NET 3.5 .Its default value is Inherit and acceptable values are Enabled,Disabled and Inherit.

4. How ASP.NET 4.0 identifies ClientID ?
In ASP.NET 4, a property called
ClientIDMode is newly introduced to identify and record the ClientId easily.

ClientIDMode has following values.
AutoID – Same as ASP.NET 3.5
Static – There won’t be any separate clientid generated at run time
Predictable-These are used particularly in datacontrols. Format is like clientIDrowsuffix with the clientid vlaue
Inherit- This value specifies that a control’s ID generation is the same as its parent.

The default value of ClientIDMode for a page is Predictable. The default value of ClientIDMode for a control is Inherit. Because the default for controls is Inherit, the default generation mode is Predictable.

5. Whether permanent redirection is possible or not ?
ASP.Net 4.0 introduced a new URL redirection method RedirectPermanent() which avoids round trips.

We can implement this as shown below:

RedirectPermanent("/newpath/newpage.aspx");

RedirectPermanent returns a 301 HTTP response—it redirects permanently to another location. Search engines such as Google and Bing will change their indexes to point to the new page directly. To call RedirectPermanent we will need to get the Response object from the HttpContext.
Then, we can call RedirectPermanent: if you pass false as the second parameter, we can perform further actions and avoid an exception.

6. Output Caching Enhancement:
ASP.NET 4 adds an extensibility point to output caching that enables you to configure one or more custom output-cache providers. Output-cache providers can use any storage mechanism to persist HTML content. This makes it possible to create custom output-cache providers for diverse persistence mechanisms, which can include local or remote disks, cloud storage, and distributed cache engines.

7. QueryExtender Control for filtering the data returned by EntityDataSource and LinqDataSource controls:
QueryExtender Control is an add-on to the DataSource Controls: EntityDataSource and LinqDataSource. QueryExtender is used to filter the data returned by these controls. As the QueryExtender control relies on LINQ, the filter is applied on the database server before the data is sent to the page, which results in very efficient operations.

i.e., QueryExtender Control is intended to be used to create filters for data that is retrieved from a data source, without using an explicit Where clause in the data source. The control can be used to filter data in the markup of a Web page by using declarative syntax.








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 HTTPcertificates 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