.Net Interview Questions and Answers

Search:

.NET architecture interview questions : - What are benefits and Limitation of using Viewstate, hidden frames and Cookies?

By : Shiv Prasad Koirala | Feb 12th, 2014 | Views : 3829 | Comments : 0 Bookmark and Share

Following are the benefits of using Viewstate:-


  • No server resources are required because state is in a structure in the page code.

  • Simplicity.

  • States are retained automatically.

  • The values in view state are hashed, compressed, and encoded, thus representing a higher state of security than hidden fields.

  • 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:-


  • Page loading and posting performance decreases when large values are stored because view state is stored in the page.

  • 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.


this.ViewState["EnterTime"] = DateTime.Now.ToString();


Benefits and limitations of using Hidden frames


Following are the benefits of using hidden frames:-


  • You can cache more than one data field.

  • The ability to cache and access data items stored in different hidden forms.

  • 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:-


  • Hidden frames are not supported on all browsers.

  • Hidden frames data can be tampered thus creating security hole.


Benefits and limitations of using Cookies


Following are benefits of using cookies for state management:-


  • No server resources are required as they are stored in client.

  • They are light weight and simple to use

Following are limitation of using cookies:-


  • 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.

  • Some users disable their browser or client device's ability to receive cookies, thereby limiting the use of cookies.

  • Cookies can be tampered and thus creating a security hole.

  • Cookies can expire thus leading to inconsistency.

Below is sample code of implementing cookies


Request.Cookies.Add(New HttpCookie("name", "user1"))


Also click and see the following ASP.NET interview questions video on distinguishing between session and viewstate


 
Rate this Article :
1 Star
2 Stars
3 Stars
4 Stars
5 Stars
1 1 1 2 1
 
 
 
 

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

Article Categories

Learn in Hindi