ASP.NET Interview Questions and Answers (1544) - Page 9

Is it possible that cookies created by asp.net application can only be accessed via server side code only? Is it possible to restrict that client side code can not access any cookie?

Yes.

it is possible to enable HttpOnly programmatically on any individual cookie by setting the HttpOnly property of the HttpCookie object to true. However, it is easier and more reliable to configure the application to automatically enable HttpOnly for all cookies. To do this, set the httpOnlyCookies attribute of the
<httpCookies> element to true.

<configuration>

<system.web>
<httpCookies httpOnlyCookies=”true”>

Does SessionID change with every request in the asp.net 2.0 application?

For any web programmer, its obvious to think and believe that SessionId remains same through out the user session and it was right till asp.net1.1. But in asp.net2.0, this behavior has changed. In the asp.net application new sessionid is returned with the response to every request until session objects are not used.

According to MSDN the reason/solution is:

“When using cookie-based session state, ASP.NET does not allocate storage for session data until the Session object is used. As a result, a new session ID is generated for each page request until the session object is accessed. If your application requires a static session ID for the entire session, you can either implement the Session_Start method in the application’s Global.asax file and store data in the Session object to fix the session ID, or you can use code in another part of your application to explicitly store data in the Session object.”


Enojy…
ViewState is encrypted.

NOTE: This is objective type question, Please click question title for correct answer.
You catch an unhandled exception in a Page_Error handler. How can you access the last error?

NOTE: This is objective type question, Please click question title for correct answer.
How can you detect if a viewstate has been tampered?

By setting the EnableViewStateMac to true in the @Page directive. This attribute checks the encoded and encrypted viewstate for tampering.
Can I use different programming languages in the same application?

Yes. You can create a few pages in C# and a few in VB.NET.
Can the App_Code folder contain source code files in different programming languages?

Yes but you need to create two subfolders inside the App_Code and then add both C# and VB.NET in the respective subfolders. You also have to add configuration settings in the web.config for this to work.
What are the different code models available in ASP.NET 2.0?

There are 2 code models available in ASP.NET 2.0. One is the single-file page and the other one is the code behind page.
Which typically consumes more memory: application state or session state?

Session state tends to use much more memory than application state, because copies of all variables are stored for each user.
Which might not work if a user has disabled cookies in his or her Web browser: application state or session state?

Session state, by default, won’t work if a Web browser that supports cookies
has cookies disabled. Application state isn’t user-specific, though, and doesn’t need to be tracked in cookies. Therefore, application state works regardless of cookies.
What is View State Chunking?

View state chunking is new in ASP.NET, version 2.0.The ViewState property retains values between multiple requests for the same page. When an ASP.NET page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field. If the data is too long for a single field (as specified in the MaxPageStateField-Length property), then ASP.NET performs view state chunking to split it across multiple hidden fields.
Is view state lost if a user refreshes a Web page? What if the user copies the URL and open it in other browser?

View state is maintained within a page’s HTML, so it is lost if a page is refreshed or if the URL is copied.
Which control requires the Web.sitemap file to display site map information?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following browser capabilities can you not check using Request.Browser?

NOTE: This is objective type question, Please click question title for correct answer.
Which method would you call to send an e-mail message and wait for the transmission to complete before proceeding?

NOTE: This is objective type question, Please click question title for correct answer.
What type of exception will the runtime throw if the SMTP server rejects a recipient e-mail address?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following can be shared between two pages.

NOTE: This is objective type question, Please click question title for correct answer.
what is the transport protocol used to call webservise ?

NOTE: This is objective type question, Please click question title for correct answer.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories