How can you send an email message from an ASP.NET Web page?
Correct Answer
You can use the SystemNetMailMailMessage and the SystemNetMailSmtpMail classes to send an email in your Web pages In order to send an email through your mail server, you need to create an object of the SmtpClient class and set the server name, port, and credentials
Technology problems
Search Results
1. What is the basic difference between ASP and ASP.NET?
Correct Answer: The basic difference between ASP and ASPNET is that ASP is interpreted; whereas, ASPNET is compiled This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted On the other hand, ASPNET uses NET languages, such as C# and VBNET, which are compiled to Microsoft Intermediate Language (MSIL)
Correct Answer: ASPNET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services It is a part of NET Framework You can create ASPNET applications in most of the NET compatible languages, such as Visual Basic, C#, and J# The ASPNET compiles the Web pages and provides much better performance than scripting languages, such as VBScript The Web Forms support to create powerful forms-based Web pages You can use ASPNET Web server controls to create interactive Web applications With the help of Web server controls, you can easily create a Web application
Correct Answer: DLR is a runtime environment that allows you to integrate dynamic languages with the Common Language Runtime (CLR) by adding a set of services, such as expression trees, call site caching, and dynamic object interoperability to the CLR The SystemDynamic and SystemRuntimeCompilerServices namespaces are used to hold the classes for DLR It also provides dynamic features to statically-typed languages, such as C# and Visual Basic to enable their interoperation with dynamic languages
4. What are the usages of the Command object in ADO.NET?
Correct Answer: The following are the usages of the Command object in AD0NET: The Command object in AD0NET executes a command against the database and retrieves a DataReader or DataSet object => It also executes the INSERT, UPDATE, or DELETE command against the database => All the command objects are derived from the DbCommand class => The command object is represented by two classes: SqlCommand and OleDbCommand => The Command object provides three methods to execute commands on the database: => The ExecuteNonQuery() method executes the commands and does not return any value => The ExecuteScalar() method returns a single value from a database query => The ExecuteReader() method returns a result set by using the DataReader object
5. What are the usages of the Command object in ADO.NET?
Correct Answer: The following are the usages of the Command object in AD0NET: The Command object in AD0NET executes a command against the database and retrieves a DataReader or DataSet object => It also executes the INSERT, UPDATE, or DELETE command against the database => All the command objects are derived from the DbCommand class => The command object is represented by two classes: SqlCommand and OleDbCommand => The Command object provides three methods to execute commands on the database: => The ExecuteNonQuery() method executes the commands and does not return any value => The ExecuteScalar() method returns a single value from a database query => The ExecuteReader() method returns a result set by using the DataReader object
Correct Answer: The code-behind feature of ASPNET enables you to divide an ASPNET page into two files - one consisting of the presentation data, and the second, which is also called the code-behind file, consisting of all the business logic The presentation data contains the interface elements, such as HTML controls and Web server controls, and the code-behind contains the event-handling process to handle the events that are fired by these controls The file that contains the presentation data has the aspx extension The code behind file has either the cs extension (if you are using the programming language C#) or the vb (if you are using the programming language Visual Basic NET) extension
7. Explain the validation controls. How many validation controls in ASP.NET 4.0?
Correct Answer: Validation controls are responsible to validate the data of an input control Whenever you provide any input to an application, it performs the validation and displays an error message to user, in case the validation fails ASPNET 40 contains the following six types of validation controls: => CompareValidator - Performs a comparison between the values contained in two controls => CustomValidator - Writes your own method to perform extra validation => RangeValidator- Checks value according to the range of value => RegularExpressionValidator - Ensures that input is according to the specified pattern or not => RequiredFieldValidator - Checks either a control is empty or not => ValidationSummary - Displays a summary of all validation error in a central location
Correct Answer: State is quite an innovative concept in Web development because it eliminates the drawback of losing state data due to reloading of a Web page By using states in a Web application, you can preserve the state of the application either at the server or client end The state of a Web application helps you to store the runtime changes that have been made to the Web application For example, as already described earlier, a change in the data source of the Web application might be initiated by a user when he/she selects and saves some products in the shopping cart If you are not using states, these changes are discarded and are not saved You may think that the whole concept of storing states is optional However, under certain circumstances, using states with applications is imperative For example, it is necessary to store states for Web applications, such as an e-commerce shopping site or an Intranet site of a company, to keep track of the requests of the users for the items they have selected on the shopping site or the days requested for vacation on the Intranet site
Correct Answer: Windows Workflow Foundation (WF) is a technology that was first introduced in NET Framework 30 WF consists of a programming model, a workflow runtime engine, workflow designer, a rules engine, and tools to quickly build workflow-based applications on Windows WF facilitates the separation between the business process code and the actual implementation code
10. What are the different types of workflow in WF?
Correct Answer: In WF 40, the following two types of workflows are used: Flowchart workflows - Helps you to create workflows using the common flowchart elements In WF, the Flowchart activity is generally used to implement a non-sequential workflow, and occasionally it implements sequential workflows in case the FlowDecision nodes are not used The Flowchart activity contains a collection of flow nodes, which inherit from the FlowNode class The following types of nodes or elements can be a part of a flowchart: => FlowStep - Executes activities of a flowchart in a sequence => FlowDecision - Shows the execution on the basis of a Boolean condition It is similar to the If construct => FlowSwitch - Shows the execution on the basis of an exclusive switch It is similar to the Switch construct Procedural workflows - Helps you to create workflows using basic and sequential execution standards In WF, procedural workflows use flow control constructs, such as While, Switch, ForEach, and If, to execute activities These flow control constructs are similar to those found in procedural languages Procedural workflows can also contain other flow control activities, such as Flowchart and Sequence