ASP.NET

  1. How do we make sure that no one has tampered with view state?
    1. Hint: EnableViewStateMac
  2. How does ASP.net maintain state in subsequent requests?
  3. Where does view state information stored?
    1. Answer: In HTML hidden fields.
  4. What is use of @OutputCache directive?
  5. Asp.Net Controls Overview
    1. http://msdn.microsoft.com/en-us/library/zsyt68f1(v=vs.100).aspx
  6. How can we create custom controls in ASP.NET ?
    1. User controls are created using .ASCX in ASP.NET. After .ASCX file is created you need to two things in order that the ASCX can be used in project:.
    1. √ Register the ASCX control in page using the <%@ Register directive. Example               <%@ Register tagprefix="Accounting" Tagname="footer" Src="Footer.ascx" %>
    2. √ Now to use the above accounting footer in page you can use the below directive.<Accounting:footer runat="server" />
  7. What is paging in data grid?
  8. What is the use of Glocal.ASAX file?
    1. It allows to execute application level events and save application level variables.
  9. Web.config Vs Machine.config?
    1. Web.Config file apply setting to one ASP.NET application while Machine.config file applies setting to all ASP.NET applications.
  10. What is the different between Authentication and Authorization?
    1. Answer:This can be a tricky question. These two concepts seem altogether similar but there is wide range of difference. Authentication is verifying the identity of a user and authorization is process where we check does this identity have access rights to the system. In short we can say the following authentication is the process of obtaining some sort of credentials from the users and using those credentials to verify the user’s identity. Authorization is the process of allowing an authenticated user access to resources. Authentication always proceed to Authorization; even if your application lets anonymous users connect and use the application, it still authenticates them as being anonymous.
  11. What is ASP.NET Tracing?
    1. Tracing allows us to view how the code was executed in detail.
  12. How do we enable Tracing?
    1. Use this at the start of the page <%@ Page Trace="true" %>
  13. Repeater Control in ASP.NET
    1. Usefull links for ASP.NET repeater control:
      1. http://www.c-sharpcorner.com/uploadfile/puranindia/repeater-controls-in-Asp-Net/
      2. http://www.c-sharpcorner.com/uploadfile/abhikumarvatsa/repeater-control-in-asp-net-part-11/
  14. What are server control or web controls? What are user controls? What are Custom Controls?
    1. http://support.microsoft.com/kb/893667
  15. What is Method overloading and overriding?
  16. What is the difference between virtual and non virtual methods?
    1. You can set a method as virtual this means you can override this method in child class but it is not necessary to override.
    2. Other are non virtual methods
    3. Link: http://beyondrelational.com/modules/1/justlearned/0/tips/9336/c-difference-between-virtual-methods-and-non-virtual-methods-invocation.aspx
  17. Which classes you can not be inherited?
    1. Sealed Classes
  18. An Asp.Net Page and Partial Classes.
    1. Asp.Net WebForm is divided into two parts, one is WebForm.aspx and the other is WebForm.aspx.cs
    2. You can see in WebForm.aspx.cs that there is a partial keyword in this class definition. This helps you use controls that you have defined in WebForm.aspx page (and you know there is no definition of controls in WebForm.aspx.cs class).
    3. An ASP.NET web form can have multiple partial classes in it but it can not be built from multiple partial classes.
    1. Code: 
    2. using System;
    3. using System.Collections.Generic;
    4. using System.Linq;
    5. using System.Web;
    6. using System.Web.UI;
    7. using System.Web.UI.WebControls;

    8. namespace PartialClases
    9. {
    10.     public partial class WebForm1 : System.Web.UI.Page
    11.     {
    12.         public partial class SecondPartialClass
    13.         {
    14.             public void Show()
    15.             {
    16.  
    17.             }
    18.         }

    19.         public partial class AnotherPartialClass
    20.         {
    21.  
    22.         }
    23.         protected void Page_Load(object sender, EventArgs e)
    24.         {
    25.             SecondPartialClass obj = new SecondPartialClass();
    26.             AnotherPartialClass obj2 = new AnotherPartialClass();
    27.         }
    28.     }
    29. }
  19.  Difference Between a WebSite and a Web Application
    1. Website is normally used for simply conveying information
    2. On website which shows normally same content for all users, they may have dynamic content but they are less user specific.
    3. A Web site may or may not  have a web application in it.
    4. Examples of web sites are Geo.tv, CNN.com, NYTimes.com
    5. Web Application are normally used for business purpose. 
    6. On a web application you normally login and then perform some operations.
  20. ViewState Vs PostBack?
    1. Lets suppose i visited some Page.aspx first time and typed in form posted it (using a submit button)and then i moved to some other form and come back to Page.aspx after some time. When i posted back Page.aspx first time all of data that i entered in text boxes are saved in view state, if enabled(hidden field in ASP.NET web forms). When i posted back first the same data considered as PostBack data. But when second time i visited this page and lets say i have changed data in some text boxes and also i added data in some blank text boxes and then when i submit form(Page.aspx) the data in all text boxes is post back data and the changed data is also stored in view state. (This is my understanding).
    2. Link: http://stackoverflow.com/questions/2953587/viewstate-vs-postback
  21. What is Control State or What is ASP.Net State Management?
    1. http://msdn.microsoft.com/en-us/library/75x4ha6s(v=vs.100).aspx
  22. How to pass values between multiple web pages in asp.net?
    1. http://msdn.microsoft.com/en-us/library/6c3yckfw(v=vs.100).aspx
  23. What are the master pages?
    1. Master pages are used to provide symmetrical layout through multiple pages.
    2. Master page have ContentPlaceHolder and the content pages are places in these content place holder.
    3. Master pages starts with <%@Master %>
    4. You have to mention the master page for content page in the page directive.  <%@ Page MasterPageFile="master1.master" %>
    5. You can also assign master page dynamically. Google it 
    6. A master page should have at least one content place holder.
  24. What is DOM(Data Object Model)?
    1. Provides a language neutral interface to use page (document) elements in client side scripting language, most commonly used with java script.
    2. DOM is not JavaScript not C# it is glue between them.
    3. You can use Page objects using DOM methods and properties.
    4. DOM objects are created in scripting language.
    5. Link: How to Use DOM objects in Java script:  https://developer.apple.com/library/mac/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/DOM.html 
  25. How to check that Page uses HTML5 or previoes version?
    1. You can check using <!DOCTYPE > declaration at the start of the page.
    2.  <!DOCTYPE > should be the first element in any HTML page.
    3. In HTML 5 there is only 1  <!DOCTYPE >  declaration. That is  <!DOCTYPE html>
    4. In HTML 4.01 they refer to DTD in  <!DOCTYPE >  declaration. DTD specifies the rule for markup language so browser renders page correctly.
    5. This is one of (from three) HTML 4.01 DOCTYPE declaration
    6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  26. What is DTD? Document Type Defination?
    1. in HTML 4.01 DOCTYPE declaration refers to DTD that will tell the browser about rules for markup language.
    2. For example let say DTD defines that you can not <i> tag inside <p> tag (just giving example) so it will restrict browser not to render or in any way it will tell the browser this is not allowed. If you page has any thing which conflict rules than may be your page does render correctly.
  27. Can i access the ViewState Data of one page in another page?
    1. Directly not but you can using StateBag class. One limitation you have to use Server.Transfer to redirect use to second page, otherwise ViewState will be lost if you use Response.Redirect and you will get exception.
    2. Link: http://stackoverflow.com/questions/2445155/can-i-access-viewstate-of-one-page-in-another-page-in-asp-net

No comments: