Monday, May 13, 2013

ASP.NET Questions and Answers – Part 4

Why we should using HttpUtility.HtmlEncode?
We should using HttpUtility.HtmlEncode method to sanitize the user input.This prevents users from injecting Javascrip into web application.

What is the difference between ASP.NET MVC 3 Web Application template and ASP.NET MVC 3 Empty Web Application?
One difference between the full ASP.NET MVC 3 Web Application template and the ASP.NET MVC 3 Empty Web Application template is that the empty template doesn’t include an Account Controller.

What is the difference between Session State and View State?
Both Session State and View State used to keep track data between the post back. Session State is server based. View State is a client based. (ASP.NET State Management Overview)

ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session. (ASP.NET Session State Overview)

View state is the method that the ASP.NET page framework uses to preserve page and control values between round trips. When the HTML markup for the page is rendered, the current state of the page and values that must be retained during postback are serialized into base64-encoded strings. This information is then put into the view state hidden field or fields. (ASP.NET View State Overview).

Related posts:

No comments:

Post a Comment