How ASP .NET different from ASP?- Scripting is separated from the HTML, Code is compiled as
a DLL, these DLLs can be executed on the server.
What is smart navigation?- The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
What is view state?- The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control
How do you validate the controls in an ASP .NET page?- Using special validation controls that are meant for this. We have Range Validator, Email Validator.
Can the validation be done in the server side? Or this can be done only in the Client side?- Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.
How to manage pagination in a page?- Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.
What’ is the sequence in which ASP.NET events are processed?- Following is the sequence in which the events occur :-
1. Page_Init.
2. Page_Load.
3. Control events
4. Page_Unload event.
Page_init event only occurs when first time the page is started, but Page_Load occurs in subsequent request of the page.
What is an application object?-Application object ca be n used in situation where we want data to be shared across users globally.
What’s the difference between Cache object and application object?-The main difference between the Cache and Application objects is that the Cache object provides cache-specific features, such as dependencies and expiration policies.
How can get access to cache object?-The Cache object is defined in the System.Web.Caching namespace. You can get a reference to the Cache object by using the Cache property of the HttpContext class in the System.Web namespace or by using the Cache property of the Page object.
What are dependencies in cache and types of dependencies?- When you add an item to the cache, you can define dependency relationships that can force that item to be removed from the cache under specific activities of dependenci es.Example if the cache object is dependent on file and when the file data changes you want the cache object to be update. Following are the supported dependency :-
1. File dependency :- Allows you to invalidate a specific cache item when a disk based file or files change.
2. Time-based expiration :- Allows you to invalidate a specific cache item depending on predefined time.
3. Key dependency :-Allows you to invalidate a specific cache item depending when another cached item changes.
What is Cache Callback in Cache?-Cache object is dependent on its dependencies example file based, time based etc...Cache items remove the object when cache dependencies change.ASP.NET provides capability to execute a callback method when that item is removed from cache.
What is scavenging?-When server running your ASP.NET application runs low on memory resources, items are removed from cache depending on cache item priority. Cache item priority is set when you add item to cache. By setting the cache item priority controls the items scavenging are removed first.
What are different types of caching using cache object of ASP.NET?- You can use two types of output caching to cache information that is to be transmitted to and displayed in a Web browser: √ Page Output Caching Page output caching adds the response of page to cache object. Later when page is requested page is displayed from cache rather than creating the page object and displaying it. Page output caching is good if the site is fairly static. √ Page Fragment Caching If parts of the page are changing, you can wrap the static sections as user controls and cache the user controls using page fragment caching.
How can you cache different version of same page using ASP.NET cache object ?-Output cache functionality is achieved by using "OutputCache" attribute on ASP.NET page header. Below is the syntax √ VaryByParam :- Caches different version depending on input parameters send through HTTP POST/GET. √ VaryByHeader:- Caches different version depending on the contents of the page header. 181 √ VaryByCustom:-Lets you customize the way the cache handles page variations by declaring the attribute and overriding the GetVaryByCustomString handler. √ VaryByControl:-Caches different versions of a user control based on the value of properties of ASP objects in the control.
How will implement Page Fragment Caching?-Page fragment caching involves the caching of a fragment of the page, rather than the entire page. When portions of the page are need to be dynamically created for each user request this is best method as compared to page caching. You can wrap Web Forms user control and cache the control so that these portions of the page don’t need to be recreated each time.
What are ASP.NET session and compare ASP.NET session with classic ASP session variables?-ASP.NET session caches per user session state. It basically uses "HttpSessionState" class. Following are the limitations in classic ASP sessions :-
1. ASP session state is dependent on IIS process very heavily. So if IIS restarts ASP session variables are also recycled.ASP.NET session can be independent of the hosting environment thus ASP.NET session can maintained even if IIS reboots.
2. ASP session state has no inherent solution to work with Web Farms.ASP.NET session can be stored in state server and SQL SERVER which can support multiple server.
3. ASP session only functions when browser supports cookies.ASP.NET session can be used with browser side cookies or independent of it.
Which various modes of storing ASP.NET session?-
1. InProc:- In this mode Session state is stored in the memory space of the Aspnet_wp.exe process. This is the default setting. If the IIS reboots or web application restarts then session state is lost.
2. StateServer:-In this mode Session state is serialized and stored in a separate process (Aspnet_state.exe); therefore, the state can be stored on a separate computer(a state server).
3. SQL SERVER:- In this mode Session state is serialized and stored in a SQL Server database.
Session state can be specified in "sessionstate" element of application configuration file. Using State Server and SQL SERVER session state can be shared across web farms but note this comes at speed cost as ASP.NET needs to serialize and deserialize data over network again and again.
Is Session_End event supported in all session modes?-Session_End event occurs only in "Inproc mode"."State Server" and "SQL SERVER" do not have Session_End event.
What are the precautions you will take in order that StateServer Mode work properly ?-Following are the things to remember so that StateServer Mode works properly :-
1. StateServer mode session data is stored in a different process so you must ensure that your objects are serializable.
2.
3. IIS metabase (\LM\W3SVC\2) must be identical across all servers in that farm.
1. SQLSERVER mode session data is stored in a different process so you must ensure that your objects are serializable.
2. IIS metabase (\LM\W3SVC\2) must be identical across all servers in that farm.
3. By default Session objects are stored in "Tempdb", you can configure it store outside "TempDB" by running Microsoft provided SQL script.
1. They are simple to implement. 2. As data is cached on client side they work with Web Farms.
3. All browsers support hidden field.
4. No server resources are required.
Following are limitations of Hidden field :-
1. They can be tampered creating a security hole.
2. Page performance decreases if you store large data, as the data are stored in pages itself.
3. Hidden fields do not support rich structures as HTML hidden fields are only single valued. Then you have to work around with delimiters etc to handle complex structures
1. They are simple to implement.
2. As data is cached on client side they work with Web Farms.
3. All browsers support hidden field.
4. No server resources are required.
Following are limitations of Hidden field :-
1. They can be tampered creating a security hole.
2. Page performance decreases if you store large data, as the data are stored in
pages itself. 3. Hidden fields do not support rich structures as HTML hidden fields are only
single valued. Then you have to work around with delimiters etc to handle complex structures.
No server resources are required because state is in a structure in the page code.
1. Simplicity.
2. States are retained automatically.
3. The values in view state are hashed, compressed, and encoded, thus representing a higher state of security than hidden fields.
4. View state is good for caching data in Web frame configurations because the data is cached on the client.
Following are limitation of using Viewstate:-
1. Page loading and posting performance decreases when large values are stored because view state is stored in the page.
2. Although view state stores data in a hashed format, it can still be tampered because it is stored in a hidden field on the page. The information in the hidden field can also be seen if the page output source is viewed directly, creating a potential security risk. Below is sample of storing values in view state.
1. You can cache more than one data field.
2. The ability to cache and access data items stored in different hidden forms.
3. The ability to access JScript® variable values stored in different frames if they come from the same site.
The limitations of using hidden frames are:
1. Hidden frames are not supported on all browsers.
2. Hidden frames data and be tampered thus creating security hole.
1. No server resources are required as they are stored in client.
2. They are light weight and simple to use Following are limitation of using cookies :-
1. Most browsers place a 4096-byte limit on the size of a cookie, although support for 8192-byte cookies is becoming more common in the new browser and client-device versions available today.
2. Some users disable their browser or client device’s ability to receive cookies, thereby limiting the use of cookies.
3. Cookies can be tampered and thus creating a security hole.
4. Cookies can expire thus leading to inconsistency. Below is sample code of implementing cookies Request.Cookies.Add(New HttpCookie("name", "user1"))
1. No server resources are required. The query string containing in the HTTP requests for a specific URL.
2. All browsers support query strings.
Following are limitations of query string :-
1. Query string data is directly visible to user thus leading to security problems.
2. Most browsers and client devices impose a 255-character limit on URL length. Below is a sample "Login" query string passed in URL http://www.querystring.com/ login.asp?login=testing. This query string data can then be requested later by using Request.QueryString("login").
2. Page_Init
3. Page_InitComplete
4. Page_PreLoad
5. Page_Load
6. Control Events
7. Page_LoadComplete
8. Page_PreRender
9. SaveViewState
10. Page_Render
11. Page_Unload
What are the new features in ASP.NET? Some of the new features in ASP.NET 2.0 are: 1. Master Pages, Themes, and Web Parts
2. Standard controls for navigation
3. Standard controls for security
4. Roles, personalization, and internationalization services
5. Improved and simplified data access controls
6. Full support for XML standards like, XHTML, XML, and WSDL
7. Improved compilation and deployment (installation)
8. Improved site management
9. New and improved development tools

No comments:
Post a Comment