ASP. NET knowledge Summary

Source: Internet
Author: User

1. Internal keywords

Solution:Internal keywords are access modifiers for type and type members. Internal types or members are accessible only in files of the same assembly.

 

2. Several Methods for passing values between ASP. NET pages

Solution:1. querystring.

Querystring is a simple value transfer method. Its disadvantage is that it displays the value to be transferred in the address bar of the browser and cannot pass objects in this method. If you want to pass a security that is not so important or a simple value, it is best to use this method.

2. Session Variables

Using session variables to pass values is the most common method. In this method, values can be transmitted not only to the next page, but also to multiple pages, the variable does not disappear until the value of the session variable is removed.

3. server. Transfer

Although this method is a bit complicated, it is also a way to pass values on the page.

3. Simple C # indexer example

Solution:

using System;
using System.Collections;
class MyClass{   
 private string[] data = new string[5];  
 public string this[int index] {
 get { return data[index]; } 
 set { data[index] = value; } }
 }
 class MyClient{
 public static void Main() {
 MyClass mc = new MyClass(); 
 mc[0] = "Rajesh"; 
 mc[1] = "A3-126"; 
 mc[2] = "Snehadara"; 
 mc[3] = "Irla"; mc[4] = "Mumbai";
 Console.WriteLine("{0},{1},{2},{3},{4}", mc[0], mc[1], mc[2], mc[3], mc[4]); }}

 

4. If. NET is used as a B/S structure system, how many layers of structure are used for development? What is the relationship between each layer and why is this layer required?

Solution:It is generally three layers.
Data access layer, business logic layer, and presentation layer.
Data access layer: adds, queries, and modifies databases.
Business Layer: generally divided into two layers. The business apparent layer communicates with the presentation layer, and the business rule layer Implements user password security.
Presentation Layer: to interact with users. For example, you can add a form.

 

5. What is an application domain?

Solution: application domain (appdomain ). It can be understood that many application domains can run in the same. Net process, which can reduce system consumption and isolate different domains to ensure security. In addition, communication between different domains in the same process is relatively simple.

AppDomainSetup info = new AppDomainSetup();
info.LoaderOptimization = LoaderOptimization.SingleDomain;
AppDomain domain = AppDomain.CreateDomain("MyDomain", null, info);
domain.ExecuteAssembly("C:\\test\\DomainCom.exe");
AppDomain.Unload(domain);

6. What is packing and unpacking?

Solution:From value type conversion to reference type -- packing.

Convert from reference type to value type -- unpack.

 

7. What classes do I need to read and write databases in. Net? What are their roles?

Solution:Sqldataadapter, dataset, sqlcommand

private static DataSet SelectRows(
DataSet dataset, string connectionString,string queryString) {    
using (SqlConnection connection = new SqlConnection(connectionString))    {        
SqlDataAdapter adapter = new SqlDataAdapter();        
adapter.SelectCommand = new SqlCommand(queryString, connection);        
adapter.Fill(dataset);       
 return dataset;    }
 }

8. How many authentication methods does Asp.net provide?

Solution:1. Windows authentication, including NTLM and kerbros

2. Form authentication.

3. Passport authentication. Passport software developer kit needs to be installed. This authentication method is suitable for Cross-Site applications. Users only have one user name and password to access any member site.

 

9. How does wsdl.exe work?

Solution:

WSDL http: // hostserver/webserviceroot/webservicename. asmx? WSDL
(Generate a. WSDL file and client proxy class described in C # language based on the specified XML Web Service)
WSDL/out: myproxyclass. CS http: // hostserver/webserviceroot/webservicename. asmx
(Generate a client proxy class-myproxyclass. CS described in C # language based on the specified XML Web Service)
WSDL/language: Vb/out: myproxyclass. VB http: // hostserver/webserviceroot/webservicename. asmx
(Generate a client proxy class-myproxyclass. VB described in VB Based on the specified XML Web Service)

 

10. What is the difference between struct and class?

Solution:

  Struct' Class
Address Allocation Stack Heap
Efficiency High Low
Intended audience Small Large and complex
Type Value Type Reference Type
Copy time Create a new structure Copy reference
Inheritance Not inherited or inherited Inherited and customizable (sealed)

 

11. What is the difference between abstract class and interface?

Solution:

  Abstract class Interface
Concept Abstract type Protocol
Non-static data member Yes Not available
Default behavior Yes Not available
Relationships with inherited classes Is Implement

 

12. There is a return statement in try {}, so will the code in finally {} following this try be executed? When will it be executed, before or after return?

Solution:Will be executed, before return.

 

13. C # reflection is an example

Solution:

Reflection, which is translated into reflection in Chinese.
This is.. net ,. NET applications are composed of several parts: 'assembly ', 'module', and 'Type (class) '. Reflection provides a programming method, this allows programmers to obtain relevant information about these components during the running period.

(1) Use Assembly to define and load the Assembly, load the module in the assembly list, and locate the type in this Assembly and create instances of this type.
(2) Use the module to understand the Assembly containing the module and the classes in the module, and obtain all global methods or other specific non-Global methods defined on the module.
(3) Use constructorinfo to understand the name, parameters, access modifiers (such as pulic or private) and implementation details (such as abstract or virtual) of the constructorinfo. Use the getconstructors or getconstructor method of type to call a specific constructor.
(4) use methodinfo to understand the method name, return type, parameters, access modifiers (such as pulic or private), and implementation details (such as abstract or virtual. Use the getmethods or getmethod method of type to call a specific method.
(5) Use fiedinfo to learn the field name, access modifier (such as public or private), implementation details (such as static), and obtain or set the field value.
(6) Use eventinfo to learn about the event name, event handler data type, custom attributes, declaration type, and reflection type, and add or remove event handlers.
(7) Use propertyinfo to understand the attribute name, data type, declaration type, reflection type, read-only or writable status, and obtain or set the attribute value.
(8) Use parameterinfo to know the parameter name, data type, input parameter, output parameter, and the parameter location in the method signature.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.