46) What is IIS? Why is it used?
Internet Information Services (IIS) is created by Microsoft to provide Internet-based services to ASP.NET Web applications. It makes your system to work as a Web server and provides the functionality to develop and deploy Web applications on the server. IIS handles the request-response cycle on the Web server. It offers the service of SMTP and front-page server extensions. As you know SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handlers.
- All browsers works with Query Strings.
- Query String would not not require any server resources so it does not exert any sort of burden on the server.
- Browser URL does not support many characters and it has limit.
- Information will be visible to the user, which leads to security issues.
There are two types of cookies -
- Session cookie - A session cookie goes away when the user shuts the browser down.
- Persistent cookie - This resides on the hard drive of the user and is retrieved when the user comes back to the Web page.
- Element which focus on a Web page is maintained during navigation.
- Most recent Web page state is only retained in the Web browser history folder.
- Flicker effect which could occur on a Web page during navigation will be minimized.
The RedirectPermanent() method used in ASP.NET 4.0 is used to redirect a page permanently. The below code snippet is an example of the RedirectPermanent() method:
We can use classes - MailMessage and SmtpMail, which are under namespace System.Net.Mail to send the email from our Web pages. To send an email through our mail server, we need to create an object of the SmtpClient class and set the credentials, name of server and port.
52) Explain methods Response.Write() and Response.Output.Write()?
- Response.Write() - allows you to write the normal output.
- Response.Output.Write()- allows you to write the formatted output.
53) What is master page in ASP.NET?
Master Page acts like a normal page. Master Pages can contain controls, code or markup as in web form. Master page will have a control called “ContentPlaceHolder”, which defines region of master page which renders HTML content of child pages which uses master page. Master pages will have extension ".master" and there will be a master directive at the top of the page as shown below -
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="TestOurSite.master.cs" Inherits=" TestOurSite " %>
54) How does the content page differ from a master page?
A content page would not be having the complete HTML source code; whereas a master page has complete HTML source code inside its source file.
55) Why do you use the App_Code folder in ASP.NET?
App_Code folder is part of ASP.NET folders. It stores any type of objects like text files, classes or reports. Advantage of App_Code folder is that if multiple classes or objects been added into this folder it creates a single dll for all.
56) What is tracing? Where is it used?
Tracing displays the details about the code execution. It is meant for getting the details of application when it is in running mode, which is really useful for troubleshooting the application. It gives an option to log the details to a file. So from the file it’s easy to figure out the root cause for an issue. .NET supports Trace Listeners, which gets the trace output and it is used to store the information in different places.
57) What is the timeout of Cookie?
The default time for a Cookie to expire is 30 minutes.
58) What are modes of Session state in ASP.NET?
- In-Process – It stores the session in local system.
- State Server – It stores the session in a process called “ASP.NET state service”.
- SQLServer – It stores the session in SQL Server database.
- Custom – It allows the custom storage provider.
59) Which namespace is used to implement debug and trace methods?
Namespace used for both these methods – “System.Diagnostic”.
60) What are the difference between Web server and Web Service?
- Web Server is the one which gives the response to all the requests of the clients. Client can use either HTTP, SOAP protocols for request. Web Server is a computer and it turns to be a server once server software is installed. Every Web Server will have its domain possibly.
- Web Services are one of the components of Web Server which is callable from client side. Client will call the Web Service by making HTTP or SOAP requests. ASP.NET allows to create a custom Web Services which is in turn called from client side.
61) How would you enable automatic paging in DataGrid ?
Below are the list of points which are to be followed in order to enable paging in Datagrid –
- Set the “AllowPaging” to true.
- Set the current page index to clicked in PageIndexChanged event.