Table of Contents
in the req in the background " >            1) When the user password is logged in, remember the session. in the req in the background
Home Backend Development C#.Net Tutorial asp .net interview questions and answers sharing

asp .net interview questions and answers sharing

Jun 23, 2017 pm 03:04 PM
.net tidy Own question interview

1. The difference between ref and out

2. There are three a tags with no id, no name, and no class. How to select the second a tag and use jquert to select

<a href ="#这是第一个" </a>
<a href ="#这是第二个"> </a>
<a href ="#这是第三个"> </a>

<script>$(function){
$("a:eq(1)").attr("href");
}</script>
Copy after login
View Code

3, What is the difference between collections, generic collections and arrays

4, What is the difference between string and stringbuilder

The string object is immutable. Every time the string class is used, a new string object must be created in the memory, which requires allocating a In the new space, stringbuilder modifies the original string when doing string concatenation operations, which improves performance!

To put it simply, string is immutable and stringbuilder is variable-length.

5. What is the difference between webapi, webservice and wcf? Why use webapi

6, how to optimize the code

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

8, if two people are operating a piece of data at the same time, how do you deal with it?

9, do you know about cache? How to use it?

Caching is a technology that trades space for time. In layman’s terms, it means that the data you get is stored in the memory for a period of time. During this short period of time, the server cannot To read the database, or the real data source, read the data you store in memory

asp.net The cache in Cache is mainly divided into three main types: page cache, data source cache, and custom data cache.

Data caching: Add some time-consuming entries to an object cache collection and store them in the form of key values. We can set the cache's expiration, priority, dependencies, etc. by using the Cache.Insert() method.

Specific implementation reference

10, how to handle global exception handling of? How did you capture it?

Handling exceptions through the webconfig customErrors node

  <system.web>
<!--添加customErrors节点 定义404跳转页面-->
 <customErrors mode="On">
      <error statusCode="404" redirect="/Error/Path404" />
    </customErrors>
 </system.web>
Copy after login
View Code

Several ways to catch exceptions

## 1. Use HttpModule to catch unhandled exceptions [Recommended]

2. Capture unhandled exceptions in Global

3. Page-level exception capture

Specific code reference

11. How do I know if this user is logged in?

Logic to verify whether the user is logged in:

           1) When the user password is logged in, remember the session. in the req in the background

      2) If the user saves the login password, remember the cookie, otherwise set the current user’s cookie to empty;

      3) Each time the user needs to go to the background When requesting, perform status check:

Does the session exist? If it exists, continue the request operation and reset the validity time of the session; , that is, it has been completed once 1);

Simple answer: You can use Session to judge, because generally speaking, you have to store the login information of each user in Session

As long as the value of Session is empty or has expired, then it can be said that the user has exited!!

12. What is reflection? Application in projects? Reflection is to dynamically obtain the assembly.
Reflection: Reflection

1) Use when the base class calls the derived class

2) Use when determining which class to call at runtime

3) During runtime, obtain module assembly class constructor attribute method information and instantiated classes,


Call constructors, properties, methods, events, and delegates Wait... After dynamically instantiating the type, you can also use reflection to perform operations on it
4) If you can determine which class to call when writing the code, then of course call it directly alright.
But in many cases (perhaps for the sake of versatility), the type that needs to be called can only be determined at runtime, so it is necessary to use reflection to obtain type-related information
To put it simply, you can use string to do whatever you want at runtime. In fact, it is a universal factory built into the .net framework.
13. How to deal with high concurrency?

14. What is npoi? If anyone uses NPOI, you can read and write WORD/EXCEL documents on a machine that does not have Office installed or a corresponding environment.
NPOI is built on POI 3.x

version, which can process

Word/Excel

documents without installing

Office

Perform read and write operations.

(2) Advantages of using NPOI 1. You can use the framework completely free

2. Contains most of the features of EXCEL (cell styles, data formats, formulas, etc.)

3. Professional technical support services (24 *7/7) (not free)
4. The file formats supported include xls, xlsx, docx.
5. Adopt an interface-oriented design architecture (you can view the namespace of NPOI.SS)
6. Support the import and export of files at the same time
7. Based on .net 2.0 and also supports xlsx and docx formats (of course also supports .net 4.0)
## 8. A large number of successful and real tests from all over the world Cases
## 9. A large number of example codes
11. You don’t need to install Microsoft’s
Office on the server. Copyright issues can be avoided.
12. It is more convenient and user-friendly than the
API of Office PIA.
13. You don’t need to spend a lot of effort to maintain
NPOI, NPOI Team will be constantly updated and improvedNPOI, absolutely cost-saving.
14. Not only can you perform operations on Excel, but you can also perform corresponding operations on doc and ppt files
Use Case : Refer to the blog park website address:

15. What are the ways to transfer values ​​between pages?

16. The format of json data transmission. If a set of data is transmitted, what is the format?

The data passed by json is passed in key/value mode. For example: { "firstName": "Brett" }

If a set of data is passed, the format 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 and what kind of locks are there? What is the function? how to use?

18, what is a transaction? When are transactions used? What are the pros and cons of business?

19. What is dependency injection, when is it used, and what are the benefits of using it?

20. What is socket communication?

21. What is a message queue?

Recommend a very good blog,

22, what is the working principle of ajax?

The principle of ajax
XMLHttpRequest is the core mechanism of ajax. It was first introduced in IE5 and is a technology that supports asynchronous requests. To put it simply, JavaScript can make requests to the server and process responses in a timely manner without blocking the user. Achieve no refresh effect. We can think of the server as a data interface, which returns a plain text stream. Of course, this text stream can be in XML format, Html, Javascript code, or just a string. At this time, XMLHttpRequest requests this page from the server, and the server writes the text result into the page. This is the same as the ordinary web development process. The difference is that after the client obtains the result asynchronously, it is not directly displayed on the page. , but is processed by javascript first and then displayed on the page. As for many popular ajax controls now, such as magicajax, etc., they can return other data types such as DataSet. They just encapsulate the result of this process. In essence, there is not much difference between them.

23, what is ORM?

ORM, that is, Object-Relational Mapping, its function is to make a mapping between the relational database and the business entity object. In this way, we When operating business objects, you no longer need to deal with complex SQL statements, you only need to simply operate the properties and methods of the objects.

Large ORM frameworks include EF and NHibernate. So far I have only been exposed to EF. I will summarize the specific advantages and disadvantages of EF later! !

24. Convert database rows to columns and columns to rows

25. How to optimize database queries?

26, what is the difference between convert.toint32 and int,parce?

Convert.ToInt32 converts the object class type into the int type

int.Parse is suitable for converting the string class type into the int type

(1)Convert.ToInt32 has many parameters, and Int.Parse can only convert string type.
(2)Parse converts String into int, char, double ....etc., that is, *.Parse(string). The value in the brackets must be string.

27, Briefly describe the differences between "=, ==, ===" in javascript?

=Assignment

==Compare whether it is generally equal "3"==3 //Can do type Implicit conversion, true

===Compare whether strict equality "3"===3 //Compare types first, then compare values, false

28. What is the output of the following code? Explain the reason
var a = null;
alert(typeof a);
var b;
alert(typeof b);
alert(c);

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

b is only declared but not initialized, so typeof(b) is undefined.

c is not defined, so alert(c) will cause an error.

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

Use the concat method to merge js arrays, array1.concat(array2).

To delete elements, use the splice method, splice(1,1), function prototype splice(index,count), which means to delete an element starting from array index 1, that is, delete the second element. elements.

30. Briefly describe the difference between a.Equals(b) and a==b?

Equals method compares content (whether the values ​​are equal), == compares reference addresses (whether they point to the same object).

31. How many types of return values ​​are there in enumerating ASP.NET MVC ActionResult?

Mainly include View (view), PartialView (partial view), Content (content), Json (Json string), Javascript (js script), File (file) and several other types.

The above is the detailed content of asp .net interview questions and answers sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Clustering effect evaluation problem in clustering algorithm Clustering effect evaluation problem in clustering algorithm Oct 10, 2023 pm 01:12 PM

The clustering effect evaluation problem in the clustering algorithm requires specific code examples. Clustering is an unsupervised learning method that groups similar samples into one category by clustering data. In clustering algorithms, how to evaluate the effect of clustering is an important issue. This article will introduce several commonly used clustering effect evaluation indicators and give corresponding code examples. 1. Clustering effect evaluation index Silhouette Coefficient Silhouette coefficient evaluates the clustering effect by calculating the closeness of the sample and the degree of separation from other clusters.

What are the employment prospects of C#? What are the employment prospects of C#? Oct 19, 2023 am 11:02 AM

Whether you are a beginner or an experienced professional, mastering C# will pave the way for your career.

Share several .NET open source AI and LLM related project frameworks Share several .NET open source AI and LLM related project frameworks May 06, 2024 pm 04:43 PM

The development of artificial intelligence (AI) technologies is in full swing today, and they have shown great potential and influence in various fields. Today Dayao will share with you 4 .NET open source AI model LLM related project frameworks, hoping to provide you with some reference. https://github.com/YSGStudyHards/DotNetGuide/blob/main/docs/DotNet/DotNetProjectPicks.mdSemanticKernelSemanticKernel is an open source software development kit (SDK) designed to integrate large language models (LLM) such as OpenAI, Azure

Teach you how to diagnose common iPhone problems Teach you how to diagnose common iPhone problems Dec 03, 2023 am 08:15 AM

Known for its powerful performance and versatile features, the iPhone is not immune to the occasional hiccup or technical difficulty, a common trait among complex electronic devices. Experiencing iPhone problems can be frustrating, but usually no alarm is needed. In this comprehensive guide, we aim to demystify some of the most commonly encountered challenges associated with iPhone usage. Our step-by-step approach is designed to help you resolve these common issues, providing practical solutions and troubleshooting tips to get your equipment back in peak working order. Whether you're facing a glitch or a more complex problem, this article can help you resolve them effectively. General Troubleshooting Tips Before delving into specific troubleshooting steps, here are some helpful

How to solve the problem that jQuery cannot obtain the form element value How to solve the problem that jQuery cannot obtain the form element value Feb 19, 2024 pm 02:01 PM

To solve the problem that jQuery.val() cannot be used, specific code examples are required. For front-end developers, using jQuery is one of the common operations. Among them, using the .val() method to get or set the value of a form element is a very common operation. However, in some specific cases, the problem of not being able to use the .val() method may arise. This article will introduce some common situations and solutions, and provide specific code examples. Problem Description When using jQuery to develop front-end pages, sometimes you will encounter

Golang framework interview questions collection Golang framework interview questions collection Jun 02, 2024 pm 09:37 PM

The Go framework is a set of components that extend Go's built-in libraries, providing pre-built functionality (such as web development and database operations). Popular Go frameworks include Gin (web development), GORM (database operations), and RESTful (API management). Middleware is an interceptor pattern in the HTTP request processing chain and is used to add functionality such as authentication or request logging without modifying the handler. Session management maintains session status by storing user data. You can use gorilla/sessions to manage sessions.

The problem of generalization ability of machine learning models The problem of generalization ability of machine learning models Oct 08, 2023 am 10:46 AM

The generalization ability of machine learning models requires specific code examples. With the development and application of machine learning becoming more and more widespread, people are paying more and more attention to the generalization ability of machine learning models. Generalization ability refers to the prediction ability of a machine learning model on unlabeled data, and can also be understood as the adaptability of the model in the real world. A good machine learning model should have high generalization ability and be able to make accurate predictions on new data. However, in practical applications, we often encounter models that perform well on the training set, but fail on the test set or real

Selected Java JPA interview questions: Test your mastery of the persistence framework Selected Java JPA interview questions: Test your mastery of the persistence framework Feb 19, 2024 pm 09:12 PM

What is JPA? How is it different from JDBC? JPA (JavaPersistence API) is a standard interface for object-relational mapping (ORM), which allows Java developers to use familiar Java objects to operate databases without writing SQL queries directly against the database. JDBC (JavaDatabaseConnectivity) is Java's standard API for connecting to databases. It requires developers to use SQL statements to operate the database. JPA encapsulates JDBC, provides a more convenient and higher-level API for object-relational mapping, and simplifies data access operations. In JPA, what is an entity? entity

See all articles