What do you understand by the RESTful Services?
“The full form of REST stands for the Representational State Transfer. Roy Fielding coined this term in 2000. RESTful is an architectural style for creating loosely coupled applications over HTTP. To make API to be RESTful, we have to follow the six constraints given below:
Client and Server Separation: Clients and Servers are isolated in the RESTful services.
Stateless: REST architecture is based on the HTTP Protocol, and the clients can cache the server response, but no client context would be stored on the server.
Uniform Interface: It is used to allow a limited set of operations defined using the HTTP Verbs. For example, GET, PUT, POST, Delete, etc.
Cacheable: RESTful architecture allows the response to be cached or not. Caching improves performance and scalability.
Code-On-Demand
Layered System
“
How can we restrict or limit access to Web API to Specific HTTP Verb?
A.We can easily restrict or limit access to an ASP.NET Web API method called using a particular HTTP method. In this process, attribute programming plays a crucial role.
How to use the Web API with ASP.NET Web Form?
“We can use the Web API with ASP.NET Web Form by performing the following three simple steps:
First, create a Web API Controller.
Now, add a routing table to the Application_Start method of Global. sax
Now, we can make a jQuery AJAX Call to Web API method and get the data.”
What is Not Rest?
“It is not a protocol
It is not a standard
It is not a replacement for SOAP”
What is BSON in Web API?
A.BSON stands for Binary Javascript Object Notation. BSON has the objects in the key-value pair that is faster for encoding and decoding. It is light-weighted like JSON, but it is much faster than JSON. Moreover, BSON is not in a readable format.
What are the media types of HTTP Requests and Response?
“Media types are used to specify the formats of the requests, responses, images, and texts.
Media types include:
Image/Png or Image/Jpg or Image/Jpeg
Text/HTML
Application/json or Application/xml”
What is a Swagger in Web API?
“Swagger is the most common template that is used in the Web API. This template is used to check the response of an API for different methods that a particular API supports. You just need to click on the verb (GET or PUT), specify tokens, body or payload (if applicable) and click on “try it out”.
Before implementation, every developer will provide you the swagger link on which you can superficially test the API. If not, the same can be achieved using a tool called POSTMAN.”
How can you make sure that Web API returns JSON data only?
A.In the header portion, you have to pass the value “application/json”.
If 200 is for all successful operation then why do we have 201 Response Codes?
“This is a tricky question. As we know, all the HTTP response codes in Web API can be manipulated by the developer and it all depends on the App Dev as how they want to configure the response codes.
Thus, you can have 200 or 201 for all successful operations. In general, 200 stands for a successful operation and 201 for the successful creation of a record.”
What parameters can you pass in the URL of the API? Can GET and POST use the same URL?
“There are a few parameters that you can pass in your URL to define the complete end-point. These are context keys, document keys or anything that facilitate the API to hit the exact endpoint.
For example, We have to hit the document “test” on Presto with the use of the context key com.express.presto.
In such a case, our URL happens to be https://www.presto.com but the complete end-point will look like
In this way, we can be sure that the endpoint will hit the test document using a specified context key.
Yes, GET and POST will have to use the same endpoint. If you don’t use the same endpoint, then it will be like you are creating a record in one URL and retrieving something else from the other URL and this won’t make any sense.”
Which library is used by the testers and developers to develop automated tests and create testing tools?
A.TestAPI is a library (utility) that is used to create automated tests and testing tools using algorithms.
What is a multilingual website?
Any website which supports multiple languages is called multilingual websites. The content of these websites are in different languages and can be converted into multiple languages. Some popular multilingual websites include Msn, Facebook, etc.
Define Web Services in ASP.net.
Web Services are the software services that serve from one machine to another using a network. These services make use of XML and provide SSL and WSS for data transmission.
What is the difference between Server.Transfer and Response.Redirect?
As we know, both Server.Transfer and Response.Redirect are used to facilitate the users to navigate from one page to the other during page execution. The major difference between them is that in Server.Transfer (as the name suggests), the transfer is done by the server and in Response.Redirect, it is done by the browser.
What are Session State Modes? List some of the important Session State Modes of ASP.net.
“Session state is something in which the session object stores information about any particular user logged into the system. This session information can be the user id or password, details about the user’s last login, last activity and so on.
This session state comes up with different storage options. Again, each option is handled by the value in the session state mode.
Important Session State Modes
State Server Mode: Stores session state in ASP.Net State Service. Session State does not hamper by the restart of the application in a particular region.
InProc Mode: A default mode in which the session state is stored in memory on the Web Server.
SQL Server Mode: Session State is stored in SQL Server Database. It is the same as State Server in preserving the session state even though the application restarts.
Custom Mode: Session state is stored in a custom storage provider. It (Custom Storage Provider) can be configured by the user.
Off Mode: This enables the offline mode. The Session State is disabled in this mode.”
What are SQL Notifications and SQL Invalidations?
“SQL notifications are the notifications that trigger when there is any change in the data which is copied in the cache.
SQL invalidation is something (you can call it a parser) that invalidates promptly when it finds any change in the data that is in the database against the copied data in the cache.”
What are Directives in ASP.Net? List down all the Important Directives.
“Directives are the instructions that are used to describe how .aspx pages will be processed by the framework. Different directives come with different options or attributes and easily provide class names, their descriptions or the files’ names of the code-behind class for any specific page.
It starts with <%@ and ends with %>.
The syntax is:
<%@[DirectiveType][Attributes or Options]%>
Important Directives:
@Page
@Assembly
@Control
@Master
@MasterType
@Implements
@Import
@Reference
@PreviousPageType
@OutputCache
@Register”
What are the Differences between Code-Behind and Code Inline?
“Code Behind is the code written in a separate class file whereas Code Inline is the code written inside an ASP.Net Web Page.
Code Behind has an extension .aspx.cs or .aspx.vb whereas Code Inline (as it is inside ASP.Net) has an extension .aspx only. Code Inline is written inside
What is Query String in ASP.Net?
“Query String is a string (collection of characters) that is passed on any web browser as a part of the address or URL. This is often separated by a question mark (?).
The syntax of the query string is Request.QueryString(variable)[(index).count]”
What is the file through which you can customize your ASP.Net Application?
web.config is the file through which we can customize our application in ASP.Net such as applying new themes, resizing images or cropping images.
Write a code for sending an email from ASP.Net Application.
” Writing a code snippet is very common in both ASP.net as well as Selenium interviews. For Selenium, we have already discussed how to send an email.
Below are the explanation and the code for sending an email from the ASP.Net application.
Explanation
In the below program, we are creating an object for MailMessage. Thereafter, we are specifying the sender and recipient email addresses. Then, we are specifying the subject line as Software Testing.
Later, we are drafting the body of the email which is then sent with the use of a Simple Mail Transfer Protocol through the localhost server.
Code With Comments
MailMessage mail = new MailMessage (); //creating an obj for MailMessage
mail.From = “xyz@xyz.com””; //specifying the sender mail id
mail.To = “”abc@abc.com””; //specifying the recipient mail id
mail.Subject = “”Software Testing””; //specifying the subject
mail.Body = “”Hi, Sending an email””; //drafting the body of the email
SmtpMail.SmtpServer = “”localhost””; //sending through the localhost server
SmtpMail.Send (mail); //passing the attribute “mail” in the Smtp.Send()”
How do you store a value in ViewState and Retrieve them?
“As we know, ViewState stores the value of the page and the user inputs on a Page.
Following is the example of how we store the value in ViewState and retrieve it.
ViewState[“emp”]=”Saket Saurav”; // Store the value in ViewState
string value=ViewState[“emp”].ToString(); //Retrieve information”
What is the Parent Class of all the Web Server control?
The parent class of all Web Server control is “System.Web.UI.Control”.
What is the Life-Span of the items in the View State?
The life span of the items in the View State depends on the life of the current page. They exist as long as the current page exists.