Asp.Net Interview Questions Answers

Question - 31 : - What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Answer - 31 : - Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist accros the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive.

Question - 32 : - Explain what a diffgram is, and a good use for one?

Answer - 32 : - The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

Answer - 33 : - Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

Question - 34 : - does the "EnableViewState" property do? Why would I want it on or off?

Answer - 34 : -
Enable ViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not. For example, if you are binding a control to data on every round trip, then you do not need the control to maintain it's view state, since you will wipe out any re-populated data in any case. ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false.

Answer - 36 : - All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.

Question - 37 : - Is it necessary to lock application state before accessing it?

Answer - 37 : -
Only if you're performing a multistep update and want the update to be treated as an atomic operation. Here's an example:
Application.Lock ();
Application["ItemsSold"] = (int) Application["ItemsSold"] + 1;
Application["ItemsLeft"] = (int) Application["ItemsLeft"] - 1;
Application.UnLock ();
By locking application state before updating it and unlocking it afterwards, you ensure that another request being processed on another thread doesn't read application state at exactly the wrong time and see an inconsistent view of it. If I update session state, should I lock it, too? Are concurrent accesses by multiple requests executing on multiple threads a concern with session state? Concurrent accesses aren't an issue with session state, for two reasons. One, it's unlikely that two requests from the same user will overlap. Two, if they do overlap,<span style="FONT-SIZE: 9pt;

Question - 38 : - Can you edit data in the Repeater control?

Answer - 38 : - No, it just reads the information from its data source.

Question - 39 : - What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?

Answer - 39 : - You must set the DataSource property and call the DataBind method.