Breaking News

Editors Picks

Showing posts with label Asp.net Interview Question And Answer. Show all posts
Showing posts with label Asp.net Interview Question And Answer. Show all posts

Saturday, July 3, 2010

ASP.NET interview question




1.What is the sequence in which ASP.NET events are processed?
  Following are the sequence of occurrence of events:-
  Page_Init
  Page_Load
  Control events
  Page_Unload event.

2.In which event are the controls fully loaded?
  Page_Load is the event that fully loads the control. Page_Init can be used to access these controls but viewstate are no fully loaded in the Page_Init.

3. How can we identify that the Page is PostBack?
   IsPostBack is the property which is used to know whether the page is post back.

4. Difference between ASP and ASP.NET?
    The following features are supported by ASP.NET:-
    Better language support
    Better control then ASP
    Control have event support
    Compiled code
    User accounts and roles
    Easy configuration
    Easy Deployment

5. What is event bubbling?
    Datagrid, repeater, and datalist has child control. These child control insteads of raising the event by themselves they pass to the parent. Since the child control pass to the parents the event it is said to be event bubbling.

6. How do you assign Page specific attribute?
    @Page directive is used to assign page specific attribute.

7. What is the use of @Register directives?
    If any custom server control is added to the page it will bo informed to the compiler through @Register directive.

8. What is the use of SmartNavigation property?
    It is a special feature provided by ASP.NET inorder to prevent redrawing and flickering when a page is postback.

9. What is AppSetting Section in “Web.Config” file?
    Web.Config is used in for webproject for configuration. User defined values can be provided using AppSetting.

10. Where is ViewState information stored?
     ViewState information is stored in the HTML Hidden Fields.

11. How can we create custom controls in ASP.NET?
    .ASCX is used to creat controls. After the .ASCX file is created two things are to be done:-
    Register the control in the page using @Register directive.
    Use the accounting footer in page.

12. How many types  of validation controls are provided by ASP.NET?
     Validation control is of six types:-
     RangeValidator
     RequiredFieldValidator
     CompareValidator
     RegularExpressionValidator
     CustomValidator

13. What is AutoPostBack feature in ASP.NET?
     AutoPostBack can be used for if you want the control to pass the postbac of any event automatically for this you require to check whether the attribute is set to be true.

14. How can you enable automatic paging in DataGrid?
     Set the attribute to true state
     Set current pageindex clicked.

15. What’s the use of “GLOBAL.ASAX” file?
     GLOBAL.ASAX file is used to execute the ASP.NET application level and also setting the variables.

16.What is the difference between “Web.Config” and “Machine.Config”?
   “Web.Config” is used to apply setting to all the web application and     “Machine.Config” apply setting only to ASP.NET application.

17. What is impersonation in ASP.NET?
     By default, ASP.NET executes in the security context of a restricted user account on the local machine. Sometimes you need to access network resources such as a file on a shared drive, which requires additional permissions. One way to overcome this restriction is to use impersonation. With impersonation, ASP.NET can execute the request using the identity of the client who is making the request, or ASP.NET can impersonate a specific account you specify in web.config.

18. What are the various ways of authentication techniques in ASP.NET?
      Windows authentication
      Forms Authentication
      Custom Authentication
      Passport Authentication

19. What is tracing in ASP.NET?
      Tracing helps to view how the code is executed in detail.

20. How do I send email message from ASP.NET?
      It provides two namespace System.WEB.mailmessage classand System.Web.Mail.Smtpmail class.                    

21. Explain the differences between server-side and client-side code?
      Client side code is executed on the browser while Server side code is executed at  the server side on IIS in ASP.NET framework,

22. What is the difference between Gridlayout and Flowlayout?
        GridLayout provides absolute positioning for controls placed on the page.   Developers that have their roots in rich-client development environments like Visual Basic will find it easier to develop their pages using absolute positioning, because they can place items exactly where they want them. On the other hand, FlowLayout positions items down the page like traditional HTML. Experienced Web developers favor this approach because it results in pages that are compatible with a wider range of browsers.

23. What are design patterns?
      Design patterns are recurring solution to recurring problems in software architecture

24. What are the different types of pattern Available?
      The three basic types available are:-
      Structural Pattern
      Creation Pattern
      Behavioral Pattern

25. What is the difference between Server.Transfer and response.Redirect?
    Server.Transfer cannot redirect to different from the server itself.
    Server.Transfer helps to preserve information.           
    Response.Redirect sends message to the browser when moving to another page.         





26. What is the difference between Authentication and Authorization?
    Authentication is something that verifies the user identity and authorization is a process where identity is checked and then provided access to the system.

27. What is the method to customize columns in Datagrid?
    The template column can be used to column in Datagrid.

28. What are the major events in GLOBAL.ASAX file?
    Events in GLOBAL.ASAX file are as follows:-
    Application_Init
    Application_Disposed:  
    Application_Error
    Application_End
    Application_Start
    Application_EndRequest
    Application_PreRequestHandlerExcute
    Application_PostRequestHandlerExecute
    Application_PreSendRequestHeaders
    Application_PostSendContent

29. In what order they are triggered?
    They're triggered in the following order: 
    Application_BeginRequest
    Application_AuthenticateRequest
    Application_AuthorizeRequest
    Application_ResolveRequestCache
    Application_AcquireRequestState
    Application_PreRequestHandlerExecute
    Application_PreSendRequestHeaders 
    Application_PreSendRequestContent 
    <<code is executed>> 
    Application_PostRequestHandlerExecute
    Application_ReleaseRequestState 
    Application_UpdateRequestCache 
    Application_EndRequest.

30. How do we enable tracing?
    <%@ Page Trace="true" %>
    The above syntax can be used to enable tracing.

31. How can we kill a user session?
   Session.Abandon can be used to kill user session.

32. What are the different IIS isolation levels?
   IIS has three level of isolation.
   LOW(IIS process)
   Medium(Pooled)
   High(Isolated)

33. What are the steps to create a window service in VB.NET?
    The steps to create a service are as follows:-
    Create a project of type “Windows Service”.
    If you see the class created it is automatically inheriting from “System.ServiceProcess.ServiceBase”.
    You can override the following events provided by service and write your custom code. All the three main events can be used that is Start, stop and continue.
    Now to install the service you need to do run the install util exe. InstallUtil <Project Path>BINMyNewService.exe

34. what is  “Web farms” ?
    Web farms have some redundancy to minimize failures. It contains two or more servers with same configuration and also same kind of content. When any request comes there is switching / routing logic which decides which web server from the farm handles the request. For instance we have two servers “Server1” and “Server2” which have the same configuration and content. So there is a special switch which stands in between these two servers and the users and routes the request accordingly.

35. How to implement MVC pattern in ASP.NET?
    The main goal of using MVC pattern is to decouple the GUI with data. It also provides an ability to view multiple views at the same time.
    The three important sections are:-
  • Model
  • Views
  •  Section

36. What is the difference between Namespace and Assembly?
    The major difference between namespace and assembly are:-
    Assembly is physical grouping up of logical units. Namespace is logically grouped classes
    Namespace can spam multiple Assembly.

37. What is Namespace?
     Namespace perform two basic functions:-
     It logically group types.
     In Object oriented environment the same class name will be used by the programmer. Namespace can use to solve this problem. 

38. What are the different types of JIT?
     Three types of JIT compilers are
  • Pre-JIT
  • Econo-JIT
  • Normal-JIT

39 What is COM?
      When any request comes there is switching / routing logic which decides which web server from the farm handles the request. For instance we have two servers “Server1” and “Server2” which have the same configuration and content. So there is a special switch which stands in between these two servers and the users and routes the request accordingly. which is language independent. DCOM is a distributed extension of COM.

40. What is Multi-threading ?
     Multi-threading forms subset of Multi-tasking. Instead of having to switch between programs this feature switches between different parts of the same program. Example you are writing in word and at the same time word is doing a spell check in background

41. Can we use event with threading?
     Yes, it is possible to use event with threading. It is one of the unique techniques used to synchronize one thread with other.

42 What is the use of interlocked class?
        Interlock class provides methods with which you can achieve functionalities like:-
  • Increment Values
  • Exchange values between variables
  • Decrement Values.
  • Compare values from any variables

43. what are wait handles?
     It sends signals regarding the status of the thread from one thread to another.
     Three kinds of wait mode are as follows:-
  • WaitOne
  • WaitAll
  • WaitAny

44. What is Asynchronous One-Way Calls? 
    One-way calls are a different from asynchronous calls from execution angle that the .NET Framework does not guarantee their execution. In addition, the methods used in this kind of call cannot have return values or out parameters. One-way calls are defined by using [OneWay()] attribute in class.

45. Do webservice have state?
    Webservice do not have any mechanism to maintain state. To inherit state it can make use of the ASP.NET intrinsic objects like application, session.

46. What are the various modes of storing ASP.NET?
     The various modes of storing ASP.NET are as follows:-
  •  InProc
  •  StateServer
  •  SQL Server

47. What are the benefits of using Hidden fields?
      Benefits of hidden fields:-
  • Very simple to implement
  • No server resources required.
  • As data captured they work with web farms.
  • Hidden fields supported by all browsers.
 
48. What are the limitations of using Hidden fields?
      Page performance decreases.
      They don’t support rich structures.
      They can be easily tampered.

49. What is cross page posting?
     It is a new feature provided by ASP.NET it enables to fire a normal post back to a different page in the application. The target page can access the values of server controls in the source page which intiated Postback.

50. What is SQL Cache dependency in ASP.NET?
     It is a new feature provided by ASP.NET. In which the cached data object can automatically be invalidated, when any related data is modified. 
Read more ...

ASP. NET interview Question -




1. Is there any event named “ModeChanged”?  
    There is a event such as mode changed that is available in DetailView Control. It take place whenever DetailsView attempts to change between mode of edit,insert and read-only. DetailsView also supports "ModeChanging" event.

2. What are the common security threats for any ASP.NET application?
    Common threats that are associated with ASP.NET application are as follows:-
    SQL Injection 
    Storing Password in simple format
    Cross side scripting
    No user input validation

3. Is it possible to delete application’s settings?
   It is possible to delete application’s setting. It consist of three arguments Application Name, Key and Section name. When all the above are present it deletes the specified key.
DeleteSettings(“testApp”) ‘ Deletes all setting of testapp.

4. Is there any difference between Ucase and toUpper?
   In terms of functionality both are the same. 

5. How to print all the variables in the session?
   It is possible by using special keys we can be able to print all the session variable.

6. What is the difference between Session.Abandon and Session.Clear()?
    Session.Abandon() will end current session by firing Session_End and in the next request, Session_Start will be fire. 
    Session.Clear( ) just clears the session data without killing it. With session.clear variable is not removed from memory it just like giving value null to this session. 
    Session ID will remain same in both cases, as long as the browser is not closed.

7. Where do you store the information about the user locale?
   System.Web.UI.Page.Culture

8. What is the size of the session ID?
   The size of the session ID is 32 bit long integer.

9. What is PLINQ?
   PLINQ stands for parallel LINQ. It is the parallel implementation of LINQ to objects.

10. How will make strings with TitleCase?
    With dynamic pages, sometimes you need to create titles dynamically. At such stage you can not go back to check whether they are stored in proper Title case or not. To make this task happen you can use string class provided toUpper() and toLower() methods but that would be much time consuming and tedious job. You can use, titlecase() method to make it single linear task.

11. What is smart navigation in .NET?
     
1. The scroll position of a Web page is maintained after postback. 
2. The element focus on a Web page is maintained during navigation. 
3.   Only the most recent Web page state is retained in the Web browser history folder. 
4.  The flicker effect that may occur on a Web page during navigation is minimized.

          
12. What is Captacha?
    CAPTCHA stands for Completely Automated Public Turing test to tell computers and Human Apart.
It is used to stop spamming as using web bots the process of sign up or submitting feedback can be made automatic. But having Captcha as additional level input stops web bots from doing successful spamming as web bots cannot read Captcha image content.

13. What are the different level of settings are available for configure cookies in browser?
    Listed cookies available on browser:-
    Low
    Medium
    Block Cookies
    Accept cookies

14. What is IsPostback property in asp.net and how does it work?
     Postback property indicates whether the page is used for the first time. This property checks for __VIEWSTATE or __EVENTTARGET parameter in Request object. if these parameters are absent that means it is requested for the first time and if these parameters are present then this request is not first request.

15. What is the difference between TransferRequest and Transfer method?
     TransferRequest: It Performs asynchronous execution for the URL provided.
     Transfer: current page execution is terminated and starts execution for the URL provided.

16. Which namespace are the generic collection are located?
    Generic collection are located in the namespace System.Collection.Generic.

17. Is it possible to create cookies with key?
    It is possible to create cookies using keys. Cookies is a dictionary at the time of initialization, if key is specified with it.


18. Is it possible to use InProc mode for sessionState in case of web garden?
    It’s not possible. As InProc mode is dependent on the worker process and in case of web garden, we have multiple worker process so session handling becomes difficult. Either we can use StateServer or SQL server mode for web garden.

    
19. What is persistent and non-persistent cookie?
    Non Persistent Cookies:- It is Temporary Cookies which get's stored in browser's memory.
    Persistent Cookie: - It is a permanent cookie that is stored in the user machine.

20. What is the difference between ResolveUrl and ResolveClientUrl?
    ResolveUrl - Returns URL relative to the site root using control’s TemplateSourceDirectory property. 
    ResolveClientUrl – Returns URL relative to the folder containing the source file in which the control is instantiated. 
Read more ...

Tuesday, June 29, 2010

ASP.Net FAQs

ASP.Net FAQs
What is the .Net framework?
.Net framework is the technology on which .Net applications are developed and deployed. The framework consist of three main components -
1. CLR (Comman Langauge Runtime)
2. Unified Classes (Framework Base Classes)
3. User and Program Interface (ASP.Net, Winforms)




What is CLR (Common Language Runtime)?
The Common Language Runtime is the execution engine of the .Net framework. CLR is responsible for loading and running the programs. Its unique feature is that it is designed to be common across many languages (cross-langauge interoperability).
The CLR or the Runtime provides functionality, such as exception handling, security, debugging and versioning support to any language that targets it.
The garbage collection process manages the allocation and deallocation of memory for an application. Whenever you creates an object, the CLR allocates the memory for the object from the managed heap.




What is CTS (Common Type System)?
The Common Type System provides a set of Common Data Types for use across all the programming languages targeted by the .Net framework. The CTS provides every language running on the top of the .Net framework with the base set of types as well as mechanisms for extending those types. The CTS supports a variety of types and operations found in most programmimg languages and therefore calling one language from another does not require type conversions.
Note: Every type supported by the CTS is derived from the namespace System.Object.



What is CLS (Common Language Specification)?
CLS provides the set of specification which has to be adhered by any language writer/compiler writer for the .Net framework. This insures interoperability.
Or
The Commom Language Specification defines a set of rules that enables interoperability on the .Net platform. These rules serves as a guide to third-party compiler designer and library builders. The CLS is the subset of CTS and there for the language supporting the CLS can uses others class libraries as if they azre thier own. Application Program Interface (APIs) that are designed following the rules of CLS can easily be used by all the .Net languages.




What are assemblies?
An Assembly is single deployable unit that contains all the information about the implementation of the classes, structures, interfaces and are similar to the DLL files. Both have the reusable pieces of code in the form of classes and functions. DLL needs to be registered but assemblies have its own METADATA.
An assembly stores all the information about itself. This is called METADATA and includes the name and version number of the assembly, security information, information about the dependencies and list of files that constitute the assembly.
Namespaces are also stored in the assemblies. In the .Net framework, applications are deployed in the form of assemblies.




What data types do the RangeValidator control support?
String, Integer, Double, Date and Currency.




Explain the difference between server-side and client-side code?
Server-side code executes on the server machine.
Client-side code executes in the client browser.

Can you edit data in the Repeater control?
No, It just reads and display the information from its data source.





Which template you must provide in order to display data in the Repeater control?
ItemTemplate.





How can you provide an alternating color scheme in a Repeater control?
For this you can use AlternatingItemTemplate.





From which base class do the all Web forms inherit?
Page class





How many classes a single .Net DLL can contain?
A single .Net DLL can contain as many classes as you want.





What does IsPostBack Property of the Web Form?
IsPostBack property of the page allows to check whether the page is being loaded for the first time.
False value means first time.
True means result of round trip.





What is the Code Behind feature of ASP.Net?
Code Behind feature of ASP.Net devides the ASP.Net page file into two files:
1. One contains presentation logic (.aspx file).
2. Code Behind file contains all applcation logic (.aspx.cs or .aspx.vb)

What is WYSIWYP?
WHAT YOU SEE IS WHAT YOU PRESENT.





What is @Page directive in ASP.Net?
@Page directive provides attributes that affect how the specific page built and compiled by ASP.Net engine.





What is cookies?
A cookie ia a small text file that resides on the client computer and can store the informatiom used by a web page or the entire site.





How to prevent a Button from validating its form?
Set the CauseValidation property of the button control to false.





Can you run an ASP.Net web application without using web.config file?
Yes.





What does CommandBehavior.CloseConnection() parameter of ExecuteReader()?
It closes the connection automatically when the DataReader is closed.





Which is the process independent Session?
SqlServer
Which one is the process dependent Session?
InProc





Which are two main keywords used for authorization in web.config file?
1. allow
2. deny





How to set a cookie?
HttpCookie myCookie = new HttpCookie("myWebSiteName");
myCookie.Value = "http://www.sunilgurjar.blogspot.com/";
myCookie.Expires = DateTime.Now.AddMonths(6);
Response.Cookies.Add(myWebSiteName);





How to get a cookie?
if (Request.Cookies["myWebSiteName"] != null)
{
string myWebSiteUrl = Request.Cookies["myWebSiteName"].Value;
}





Some ASP.Net acronyms are...
CIL - Common Intermediate Language
The language all .NET languages compile to. Equivalent to Java bytecode.
CLI - Common Language Infrastructure
The combination of the CLR, CLS, CTS and CIL
CLR - Common Language Runtime
The runtime environment itself, including garbage collection, threading etc.
CLS - Common Language Specification
A set of conventions intended to promote language interoperability.
CTS - Common Type System
The language-neutral type system used in the CLI.
IL - Intermediate Language
More commonly used abbreviation for CIL.
VES - Virtual Execution System
Another name for the CLR as far as I can tell.





Describe .Net Framework Class Library.
It consist of thousands of Pre-developed classes that can be used to build robust .Net applications.





What is garbage collection?
Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer", which is written by the user). Some garbage collectors, like the one used by .Net, compacts memory and therefore decrease your programs working set.



What is Web.Config File?
It is an optional XML File which stores configuration details for a specific ASP.Net web application.
Note: When you modify the settings in the Web.Config file, you do not need to restart the Web service for the modifications to take effect. By default, the Web.Config file applies to all the pages in the current directory and its subdirectories.




Name the configuration files supported by ASP.Net.
Configuration files are used to control and manage the behavior of a web application.
1. Machine.config
2. Web.config





What are .Net data types?
The .Net Framework provides an extensive system of types that allow you to store, manipulate and pass values between members of your application. The .Net Framework is strongly typed, meaning that objects of one type cannot be freely exchanged with objects from another type. Implicit and explicit conversions allow you to convert data types when necessary.
.Net data types can be broken down into the following subcategories:
1. Integer types
2. Floating-Point Types
3. Non-Numeric data types such as:
       Boolean
       Char
       String
       Object





What are the exceptions?
Exceptions represent a breach of an implicit assumption made within code. For example, if your code tries to access a file that is assumed to exist, but the file is missing, an exception would be thrown. However, if your code does not assume that the file exists and checks for its presence first, this scenario would not necessarily generate an exception.
Exceptions are not necessarily errors. Whether or not an exception represents an error is determined by the application in which the exception occurred. An exception that is thrown when a file is not found may be considered an error in one scenario, but may not represent an error.





Can I run my .Net Application without .Net Framework?
No you cannot. The .Net Framework must be installed in the machine on which you want to run .Net Application .





Can I run my application which was built with a newer .Net Framework ( for example .Net 2.0, .Net 3.0, .Net 3.5 ) on a machine that has a lower .Net Framework ( for example .Net Framework 1.1 ) installed?
No, you cannot, you will need to install the latest .Net Framework.





What DataReader class do in ADO.Net?
To get read-only and forward only access to data we use DataReader. The DataReader object reduces the system overhead because one row at a time is taken into memory so it is quite lightweight. To get second object connection is reconnected. We can create a DataReader object by Execute Reader() method. There are two Data Reader class one is SqlDataReader and other one is OleDbDataReader.

What is the default maximum size of the file that can be uplaoded by the ASP.Net application.
4096 KB (4MB)





What is the default executionTimeOut limit for that an ASP.Net request is allowed to run before it is automatically terminated?
90 Seconds.





How to align Text in the Textbox Control?
TextBox1.Style["text-align"]="right";





How to convert TextBox value into a DateTime variable?
DateTime dt = DateTime.Parse(TextBox1.Text);





How to programmatically set the width of the textbox control?
TextBox1.Width = Unit.Pixel(100);





How to display data in Textboxes using DataSet?
//Populate the DataSet
//...

//Display in TextBoxes using Column Name
TextBox1.Text = ds.Tables [0].Rows[0]["ProductId"].ToString ();
TextBox2.Text =ds.Tables [0].Rows[0]["ProductName"].ToString ();


//Display in TextBoxes using Column Index
TextBox1.Text = ds.Tables [0].Rows[0][0].ToString ();
TextBox2.Text =ds.Tables [0].Rows[0][1].ToString ();





Is there a TextArea in ASP.Net?
You can use the TextBox webserver control and set the TextMode = MultiLine



How to create an array of Web Server Controls?
//HTML


TextBox[] textboxes = new TextBox[5];
for (int i=0; i<5; i++)
{
textboxes[i] = new TextBox();
textboxes[i].ID = "TextBox" + i;
textboxes[i].AutoPostBack = true;
PlaceHolder1.Controls.Add(textboxes[i]);
}





Can two different programming languages be mixed in a single ASPX file?
No. ASP.Net uses parsers to strip the code from ASPX files and copy it to temporary files containing derived Page classes, and a given parser understands only one language.





Can I use custom .Net data types in a Web form?
Yes. Place the DLL containing the type in the application roots bin directory and ASP.Net will automatically load the DLL when the type is referenced. This is also what happens when you add a custom control from the toolbox to your web form.





What is the Microsoft Intermediate Language (MSIL)?
MSIL is the CPU-independent instruction set into which .Net Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross-language integration.
Prior to execution, MSIL is converted to machine code. It is not interpreted.





How can I see what assemblies are installed in the global assembly cache?
The .Net Framework ships with a windows shell extension for viewing the assembly cache. Navigating to % windir%\assembly with the Windows Explorer activates the viewer.





What is garbage collection?
Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer", which is written by the user). Some garbage collectors, like the one used by .Net, compacts memory and therefore decrease your programs working set.





How do you exclude an ASP.Net page from using Themes?
To remove themes from your page, use the EnableTheming attribute of the Page directive.

Do webservices support data reader?
No. However it does support a dataset.





What is the ExecutionTimeout in ASP.Net?
The ExecutionTimeout property indicates the maximum number of seconds a request is allowed to execute before being automatically shut down by ASP.Net. The default is 90 seconds.





What is "Literal" control in ASP.Net?
Performs the same function as "Label" control, but has no styling properties, just a Text one because it derives from Control class, not from WebControl class.





What is "AdRotator" control in ASP.Net?
Displays several images in succession, with different on displayed after each server round trip. Use the AdvertisementFile property to specify the XML file describing the iamges and the AdCreated event to perform processing before each image is sent back. You can also use target property to name a window to open when the image is clicked.





What is "Wizard" control in ASP.Net?
An advanced control used to simplify the common task of getting several pages of user input in one go. You can add multiple steps to a wizard which can be presented to a use sequentialy or non-sequentialy, and rely on this control to maintain state and so on.





What is the "MultiView" Control in ASP.Net?
A control that contains one or more View controls, where only one View is rendered at a time. The currently displayed view is specified using ActiveViewIndex, and you can detect if the view changes.





What is "View" Control in ASP.Net?
A container control, much like PlaceHolder, But designed for use as a child of MultiView. YOu can tell if given View is being displayed using Visible, or use the Activate and Deactivate events to detect changes in activation state.

What is "ImageMap" control in ASP.Net?
Like Image control, but aloows you to specify specific action to trigger if user click one or more hot spots in the image. The action to take can either be a postback or a redirection to another URL. Hot spots are supplied by embedded controls that derive from HotSpot, such as RectangleHotSpot and CircleHotSpot.





What is "ReportViewer" control in ASP.Net?
An advanced control for displaying reporting services data.





What are the types of authentication in ASP.Net?
ASP.Net provides infrastructure for authentication and authorization that will meet most of your needs for securing an .Net application. Four schemes are available in ASP.Net:
1. Forms-based authentication
2. Windows-based authentication
3. Microsoft Passport authentication
4. None - authentication disabled





What is the Form-based authentication in ASP.Net?
Forms authentication generally refers to a system in which unauthenticated requests are redirected to an HTML form, using HTTP client-side redirection. Forms authentication is a good choice if your application needs to collect its own user credentials at logon time through HTML forms. The user provides credentials and submits the form. If the application authenticates the request, the system issues a form that contains the credentials or a key for reacquiring the identity. Subsequent requests are issued with the form in the request headers. They are authenticated and authorized by an ASP.NET handler using whatever validation method the application specifies.
Note that forms authentication is often used for personalization, where content is customized for a known user. In some of these cases, identification is the issue rather than authentication, so it is enough to merely store the user name in a durable form and use that form to access the users personalization information.





What is Windows-based authentication in ASP.Net?
The WindowsAuthenticationModule provider relies on IIS to provide authenticated users, using any of the mechanisms IIS supports. The provider module constructs a WindowsIdentity object. The default implementation constructs a WindowsPrincipal object and attaches it to the application context. The WindowsPrincipal object maps identities to Windows groups.
An important reason to use the Windows Authentication provider is to implement an impersonation scheme that can use any of the authentication methods that might have already been performed by IIS before passing the request to the ASP.NET application. To do this, set the authentication mode to Windows, and confirm that the impersonate element is set to true.





What is difference between Execute Reader, ExecuteNonQuery and Execute Scalar?
  • Execute Reader: Use for accessing data. It provides a forward-only, read-only, connected record set.
  • ExecuteNonQuery: Use for data manipulation, such as Insert, Update, Delete.
  • Execute Scalar: Use for retrieving 1 row 1 col. value., i.e. Single value. e.g.: for retrieving aggregate function. It is faster than other ways of retrieving a single value from DB.





What is Strongly Typed Dataset Object?
Strongly typed Dataset object allows you to create early-bound data retrieval expression.
Advantage of Strongly Typed dataset
  • It is faster than late-bound data retrieval expression.
  • Its column name is shown in intelligence as you type code.

What is DataAdapter Object?
It populates dataset from data source. It contains a reference to the connection object and opens and closes the connection automatically when reading from or writing to the database.

Example:
SqlDataAdapter daEmp = new SqlDataAdapter("select EmpID, EmpName, Salary from Employees", conn);

Fill Method
It is used to populate dataset.
example: daEmp.Fill(dsEmp,"Employee");

Update Method
It is used to update database.
example: daEmp.Update(dsEmp,"Employee");





What is DataSet Object in ADO.Net?
Dataset is a disconnected, in-memory representation of data. It can contain multiple data table from different database.

They contain multiple Datatable objects, which contain columns and rows, just like normal data base tables. You can even define relations between tables to create parent-child relationships.

Example
DataSet dsEmp = new DataSet();





What is DataReader Object in ADO.Net?
It provides a forward-only, read-only, connected recordset.

It is most efficient to use when data need not to be updated, and requires forward only traverse. In other words, it is the fastest method to read data.

Example:
  1. Filling dropdownlistbox.
  2. Comparing username and password in database.
SqlDataReader rdr = cmd.ExecuteReader();
//Reading data
while (rdr.Read())
{
//Display data
string contact = (string)rdr["ContactName"];
string company = (string)rdr["CompanyName"];
string city = (string)rdr["City"];
}





What is Command Object in ADO.Net?
It allows to manipulate database by executing stored procedure or sql statements.

A SqlCommand object allows you to specify what type of interaction you want to perform with a data base.

For example, you can do select, insert, modify, and delete commands on rows of data in a data base table.
SqlCommand cmd = new SqlCommand("select * from Employees", conn);





What is the Connection Object in ADO.Net?
It establishes connection.
The connection helps identify the data base server, the data base name, user name, password, and other parameters that are required for connecting to the data base.

Example:
SqlConnection conn = new SqlConnection( "Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");





How to retrieve value of a field in a dataset?
ds.Tables["TableName"].Rows[0]["ColumnName"];





How to truncate the data in the column?
protected string TruncateData( string strNotes )
{
if (strNotes.Length > 20)
{
return strNotes.Substring(0,20) + "...";
}
else
{
return strNotes;
}
}



Read more ...

Contact Us

Name

Email *

Message *