ASP. NET face question and answer sharing

Source: Internet
Author: User
Tags add time
The difference between 1,ref and out

2, there are three a tags no id, no name, no class how to select the second a tag, with Jquert Select

<a href = "#这是第一个" </a><a href = "#这是第二个" > </a><a href = "#这是第三个" > </a><script>$ ( function) {$ ("A:eq (1)"). attr ("href");} </script>
View Code

3, collection, generic set and array what's the difference

What's the difference between 4,string and StringBuilder?

The string object is immutable, and each time the string class is used, a new string object is created in memory, which requires a new space to be allocated for the object, and StringBuilder is modified on the original string when the string is concatenated, improving performance!

Simply put, the string is immutable, and the StringBuilder is variable-length.

What is the difference between 5,webapi,webservice and WCF? Why do you use Webapi

6, how the code is optimized

7, how to optimize the database, how to optimize the query?

8, if there are two people working on a data at the same time, how do you deal with it?

9, does the cache know? How is it used?

Cache is a space for time, the popular point is to put the data you get in memory for a period of time, in this short time the server does not read the database, or the real data source, but read the data you stored in memory

the main types of caches in ASP: page caching, data source caching, and custom data caching. Three main kinds.

Data caching: Add time-consuming entries to an object cache collection and store them as key values. We can use Cache.Insert() methods to set the expiration, priority, dependencies, etc. of the cache.

Specific implementation Reference

10, how is global exception handling handled? How did you catch it?

Handling exceptions through Webconfig customErrors nodes

  <system.web><!--Add customErrors node definition 404 Jump page--<customerrors mode= "on" >      <error statuscode= "404" redirect= "/error/path404"/>    </customErrors> </system.web>
View Code

Several ways to catch exceptions

1. Capturing unhandled exceptions by HttpModule "recommended"

Unhandled exception caught in 2.Global

3. Page-level exception capture

Specific code reference

11, how do I know if my user is already logged in?

Logic to verify that the user is logged in:

1) User password login, in the background req remember session.

2) If the user saves the login password, remember the cookie, otherwise the current user's cookie is set to null;

3) Perform a status check each time a user needs to make a request to the background:

Does the session exist? If present, proceed with the request operation and reset the session's effective time again;

If it does not exist, then determine if the cookie exists? If present, use this cookie to complete the automatic login, that is, the completion of 1);

If it does not exist, the page is redirected to the login page.

A simple answer: You can use the session to judge, because generally you each user's login information, you have to deposit into the session
As long as the session value is empty or has expired, then you can say that the user has exited!!

12, what is reflection? Application in the project?

Reflection is the dynamic acquisition of an assembly.

Reflection: Reflection
1) When a base class calls a derived class
2) at run time, determine which class to invoke using the
3) Gets the information about the module Assembly class constructor property method and the instantiation class at run time,
Call constructors, properties, methods, events, delegates, etc... You can also use reflection to perform actions on a type after it is dynamically instantiated
4) If you can determine which class to call when you write the code, it is good to call it directly.
But in many cases (perhaps for versatility), it is necessary to determine the type of call to be made at runtime, so it is important to use reflection to obtain information about the type.

In a nutshell, what you can do with a string in runtime is actually a universal factory built within the. NET Framework

13, how is high concurrency handled?

What is 14,npoi? If any use

with Npoi, you can read and write Word/excel documents on a machine that does not have Office installed or the appropriate environment. Npoi is built on the POI 3.x version, which can read and write word/excel documents without Office installation.

(ii) Use NpoiThe advantages 1. You can use the framework completely for free 2. Contains most Excel features (cell style, data format, formula, etc.) 3. Professional Technical Support Service (24*7) (not free) 4. The file format that supports processing includes xls, xlsx, docx. 5, adopt interface-oriented design architecture (can view Npoi. The namespace of the SS) 6. Support file import and export at the same time 7.. NET 2.0 also supports xlsx and docx formats (and, of course,. NET 4.0) 8. A lot of successful and real test cases from all over the world 9, a large number of instance code 11, you do not need to install Microsoft Officeon the server, you can avoid copyright issues. 12. It is more convenient and user-friendly than the Office PIA API . 13, you do not have to spend a great effort to maintain npoi, npoi Team will continue to update, improve Npoi, absolute cost savings. 14, not only with Excel can operate, for doc, ppt file can also do the corresponding operation use case : Refer to Blog Park website:

15, how to transfer the values between pages?

16,json the format of the transmitted data, what format is it if it is passed a set of data?

The data passed by JSON is passed as a key/value example:{"FirstName": "Brett"}

If you are passing a set of data, the format is as follows!!

{"People": [

{"FirstName": "Brett", "LastName": "McLaughlin", "email": "AAAA"},

{"FirstName": "Jason", "LastName": "Hunter", "email": "BBBB"},

{"FirstName": "Elliotte", "LastName": "Harold", "email": "CCCC"}

]}

17, what is a database lock, what are the locks? What is the role? How do I use it?

18, what is a transaction? When do I use a transaction? The benefits and drawbacks of the business?

19. What are the benefits of dependency injection and when to use it?

What is 20,socket communication?

21, what is Message Queuing?

recommend a very good blog,

How does 22,ajax work?

The principle of Ajax
XMLHttpRequest is the core mechanism of Ajax, which was first introduced in IE5 and is a technique that supports asynchronous requests. Simply put, JavaScript can request and process responses to the server in a timely manner without blocking the user. Achieve a no-refresh effect. We can think of the server as a data interface, which returns a plain text stream, of course, the text stream can be in XML format, can be HTML, can be JavaScript code, can be just a string. At this time, XMLHttpRequest request this page to the server side, the server side writes the result of the text to the page, which is the same as the normal web development process, but the client asynchronously obtains this result, does not display directly in the page, but first by the JavaScript processing, but After the page is displayed. As for many of the Ajax controls that are now popular, such as Magicajax, you can return other data types such as datasets, but only encapsulate the results of this process, essentially they're not much different.

What is 23,orm?

ORM, the Object-relational Mapping (Object relational mapping), is a mapping between a relational database and a business entity object, so that when we manipulate the business object specifically, There is no need to deal with complex SQL statements, simply manipulate the object's properties and methods.

Large ORM Framework has EF, NHibernate, so far I only contact EF, the specific advantages and disadvantages of EF and then summed up!!

24, database row to column, column change

25, how to deal with database query optimization?

What's the difference between 26,convert.toint32 and Int,parce?

Convert.ToInt32 converting an object class type to an int type

Int. Parse is suitable for converting a string class type to an int type

(1) Convert.ToInt32 parameters are more, Int.parse can only convert string types.
(2) The parse is to convert a string into a int,char,double .... And so on, that is *. Parse (string) must be a string in parentheses:

What is the difference between "=, = =, = = =" in JavaScript?

= assigned value

= = comparison is generally equal to "3" ==3//will do the type of implicit conversion, true

= = = comparison is strictly equal to "3" ===3//First comparison type, then value comparison, false

28, see the following code output why? explain why
var a = null;
Alert (typeof a);
var b;
Alert (typeof B);
alert (c);

A is null and an object, so typeof (a) is object.

b only the declaration is not initialized, so typeof (b) is undefined.

c is undefined, so alert (c) will error.

29. Write JavaScript code to merge two arrays and delete the second element.

Combine JS arrays with the Concat method, Array1.concat (array2).

Delete elements using the Splice method, splice, function prototype splice (INDEX,COUNT), which deletes 1 elements from the array index 1, deletes the second element.

30. Brief introduction of A. What is the difference between Equals (b) and a==b?

The Equals method compares the content (the value is equal), = = compares the reference address (whether it points to the same object).

31. There are several types of return values for the enumeration of ASP. ActionResult?

mainly has view (view), Partialview (partial view), content (contents), JSON (JSON string), Javascript (JS script), file (files) and several other types.

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.