. Net interview questions-ASP. NET developers

Source: Internet
Author: User
Tags form post net thread

Most of the problems in this article are analyzed from the network, and some personal issues are added. All references indicate the source, or are provided directly in the form of a URL. If you have any incorrect support, please check it out in time! Thank you!

ASP. NET (UI) Developer

  1. Describes how a browser-based form post becomes a server-side event, such as buttonemedionclick.

    For this question, please refer to artech's article http://www.cnblogs.com/artech/archive/2007/04/06/702658.html.

  2. What is PostBack?

    PostBack refers to the process of sending a response, that is, the server re-generates a page and sends it to the client. This article is recommended by Comrade.ArticleHttp://www.cnblogs.com/hjf1223/archive/2008/01/03/1024969.html

  3. what is viewstate? Is it encoded? Encrypted? Who will use viewstate?

    viewstate is a tool used to save information between PostBack. This information is stored in a hidden element on the page. By default, viewstate uses base64 encoding. Therefore, security issues exist. There are two ways to protect viewstate: tamper-proofing and encryption. when it comes to anti-tampering, we think of the use of hash Code . you can add the following code to the top of the page: Page enableviewstatemac = true. By default, Asp.net uses sha1 algorithm instead of MD5 Algorithm to generate a hash, but this can be performed on the machine. configure machinekey validation = "MD5" in config. Viewstate encryption: you only need to set machinekey validation = "3DES" in machine. config to encrypt viewstate with DES.

    for example, the control requires viewstate to save the status value between two rounds, such as the value in the text box.

  4. Why is the element used? Which two ASP. NET technologies does it use?

    machinekey is used in the following scenarios:

    Asp.net encrypts and decrypts cookie data when forms authentication is used. To ensure that this part of data is not tampered.

    encrypt and decrypt viewstate data. To ensure that this part of data is not tampered.

    when an out-of-process session is used, the session Status identifier is verified.

    from Yan Xiaojun's article http://blog.joycode.com/ghj/archive/2009/03/18/115516.joy

  5. The three session states in ASP. NET 1.1 are provided.ProgramAnd their advantages and disadvantages?

    Process-in-process. Fast, but difficult to adapt to large-scale applications.

    ASP. NET State Service-ASP. NET State service. Speed and capacity compromise. If a dedicated status server is used, it can be expanded.

    SQL Server session state management: slow. But the reliability is the strongest. It also has high scalability and is suitable for large-scale applications.

  6. What is Web gardening? How to use it in design?

    Web gardening is also called Web garden. (Note that this is not the same as Web farm, that is, Web farm .) The Web garden is configured on a single server by specifying multiple worker processes for the application pool. The web site uses multiple servers for a website. The following descriptions of the concept and usage of Web parks are referenced in technet:

Web garden Definition

Working in IIS 6.0Process Isolation ModeThe application pool improves the reliability of websites or applications by isolating applications and working processes that serve these applications. To achieve higher reliability, you can configure the application pool to be supported by multiple worker processes. The application pool that uses multiple working processes is called "Web Garden ". The Worker Process in the Web garden will share requests that reach the specific application pool. If a worker fails, the other worker can continue to process the request.

 

Enhancement of Web parks on websites

  • Reliable request processing: when a worker process in the application pool stops processing (for example, when the script engine stops responding ), other worker processes can accept and process requests from the application pool.

 

 

  • Reduced resource contention: when the web garden reaches a stable state, each new TCP/IP connection will be allocated to a worker process in the Web garden according to the loop scheme. This can balance the workload and reduce the competition for resources bound to the worker process.

 

Configure web garden-use IIS Manager (only this configuration method is attached here)

1. Use the Administrator account to run IIS manager. In IIS manager, expand the Local Computer and application pool, right-click the application pool, and then click Properties ".

2. Click the "performance" tab, and in the "Maximum number of worker processes" box under "Web Garden", type the number of worker processes to be specified to the application pool. (To form a web garden, you must enter a value greater than 1 for the application pool .)

3. Click OK ".

 

  1. Suppose there is an ASP. NET application, how many application objects are allowed in a single process? What about the two processes? What if two web gardening processes are enabled? What is the impact on the design?

    A process can run an application pool, and an application pool can run multiple application objects. Therefore, multiple application objects can be allowed in a single process. If you do not configure web gardening, only one application pool can be run in the next process. The two processes run two application pools. After configuring web gardenning, an application pool can run in two or more processes. For the benefits, see the analysis in question 6th.

     

  2. Will ASP. NET reuse threads between multiple requests? Does each httprequest have its own thread? Should you use ASP. NET Thread Local Storage?

    When a time-consuming operation needs to be completed asynchronously, you can use threadpool to perform this operation step by using the thread in the thread pool. In this case, threads can be reused. Each httprequest should have its own thread. In addition, content related to. NET is not found in the thread local storage. However, as its name implies, local thread storage should be the storage of variables related to a thread. I think Thread Local Storage can solve this problem under certain circumstances by referring to the statement that the static variables used in the static method mentioned in the online article may cause problems in multithreading.

     

  3. [Threadstatic] is the attribute useful in ASP. NET? Does it have any side effects? Is it good or bad?

    [Threadstatic] It can also solve the problem that the static variables in the static method will have problems in the multi-threaded environment. You only need to mark these static variables as [threadstatic. [Threadstatic] is a feature that makes variable threads unique. As for the side effects, [threadstatic] is not very stable. The best way to solve this problem is to use context provider to access thread-related data. For more information about the use of context, see this article. Http://www.cnblogs.com/vwxyzh/archive/2009/02/21/1395416.html

     

  4. How to Use httphandler to simplify the existing design of providing verification images for. aspx pages.

    Zhang Ziyang's article introduces this process very well, so I don't need to talk nonsense. I will go directly to the website. Http://www.tracefact.net/Asp-Net/Introduction-to-Http-Handler.aspx

     

  5. What type of events does httpmodule subscribe? What is the impact on implementation? What should I do if I do not intend to re-compile the ASP. Ne application?

    Httpmodule processes a series of events of the httpapplication object to influence the HTTP processing pipeline. These events are registered in the init method of httpmodule, including:

beginrequest

authenticaterequest

authorizerequest

resolverequestcache

acquirerequeststate

prerequesthandlerexecute

postrequesthandlerexecute

releaserequeststate

updaterequestcache

endrequest

I don't know what the original question is for the last two questions.

 

  1. Specifies the way to express any terminal (URL) and the way to route requests to that end point in ASP. NET.

    Basically, the way to route a URL is to first obtain the requested URL and then analyze it. If a rule is matched, It is routed to a specified new URL. This process can be processed in the application_start event of Global. asax or in the Custom ihttpmoudleApplication_beginrequest is completed in the time processing function. You can refer to this article for a good example.

    Http://niunan.javaeye.com/blog/460681

     

  2. explains how cookies work. An example of cookie abuse is provided.

    cookie is a short text message, user requests and pages are transmitted between the Web server and the browser. Each time a user accesses a site, the Web application can read the information contained in the cookie. If the user accesses the page on the site again, for example, when the user enters URL: www.cnblogs.com, the browser searches for the cookie associated with the URL on the local hard disk. If the cookie exists, the browser sends it along with the page request to your site.

    the most fundamental use of cookies is: cookies can help websites save information about visitors. In a more general sense, cookie is a way to maintain the continuity of Web applications (that is, to execute "state management"), so that the Web site remembers you.

    examples of abuse have not yet been found, however, according to its principle, it can be seen that the features passed between the browser and the server determine that the cookie is not suitable for filling too much content.

  3. How important is httprequest. validateinput?

    The httprequest class uses the input verification flag to track whether to perform verification on the request set accessed through cookies, forms, and querystring attributes. The validateinput method sets these flags to perform input verification when calling the get accessors of cookies, forms, or querystring attributes. The verification works by checking all input data against the hard-coded list of potentially dangerous data.

    If the page directive or configuration enables the verification feature, this method is called during the processrequest processing phase of the page. If the verification function is not enabled, you can call the validateinput method by code.

    There is no deep understanding of the importance of this. Please advise.

     

  4. What data is transmitted through HTTP header?

    The HTTP header includes four parts: Common headers, request headers, response headers, and object headers.

    General HeaderCommon examples:Cache-control header field: Cache-control specifies the cache mechanism for requests and responses.Date header field: The date header field indicates the message sending time. The time description format is defined by rfc822.Pragma header domain: The Pragma header field is used to contain specific instructions. The most commonly used is Pragma: No-cache.

    Request Message: Request messages, such as options, get, Head, post, put, delete, and trace.

    Response Message: There are five main categories: 1xx: Information Response class, indicating that the request is received and processed continuously. 2XX: Successful response class, indicating that the action is successfully received, understood, and accepted. 3xx: redirect response class. To complete the specified action, you must accept further processing. 4xx: client error. The client request contains a syntax error or cannot be correctly executed. 5xx: A server error occurs. The server cannot correctly execute a correct request.

    Entity: Including allow, content-base, content-encoding, content-language, Content-Length, content-location, Content-MD5, content-range, content-type, etag, expires, last-modified and extension-header.

     

  5. Compare http get and post? What is head?

    HTTP defines different methods for interaction with the server. The most basic methods are get and post. In fact, get applies to most requests, while retaining post is only used to update sites. According to the HTTP specification, get is used to obtain information, and should be secure and idempotent. The so-called security means that this operation is used to obtain information instead of modifying information. In other words, get requests generally do not have side effects. Idempotence means that multiple requests to the same URL should return the same result. The complete definition is not as strict as it looks. Basically, the goal is that when a user opens a link, she can be confident that the resource has not changed from her own perspective. For example, the front pages of news sites are constantly updated. Although the second request will return a different batch of news, this operation is still considered safe and idempotent because it always returns the current news. And vice versa. POST requests are not that easy. Post indicates a request that may change resources on the server. Taking the news site as an example, the reader's comments to the article should be implemented through the POST request, because the site is already different after the annotation is submitted (for example, an annotation appears below the article );
    If method is not specified during form submission, the default value is get. The data submitted in form will be appended to the URL? Separated from the URL. The letter and number characters are sent as they are, but spaces are converted to "+". Other symbols are converted to % xx, XX represents the ASCII (or ISO Latin-1) value in hexadecimal notation. The data submitted for the GET request is placed in the HTTP Request Header, while the data submitted for the post is placed in the object data;
    Data submitted in get mode can contain a maximum of 1024 bytes, whereas post mode does not.

    From: http://www.cnblogs.com/stu-acer/archive/2006/08/28/488802.html

    Currently, the difference between get and post is not so obvious in actual application.

    The head verb is used to request the first part of the page, which does not seem to be commonly used.

  6. Give at least 6 HTTP status codes and their meanings

    List several common examples:

    200 OK/400 bad request/403 Forbidden/404 Not found/500 internal server error/504 gateway timeout

     

  7. What is the working principle of IF-not-modified-since? How to Implement ASP. NET?

    To be answered by experts.

     

  8. explanation <@ outputcache %> and how to use varybyparam and varybyheader.

    @ outputcache command is used to set ASP in declarative mode.. NET page cache. Its common attributes are as follows:
    Duration: sets the cache expiration time in seconds.
    varybyparam: Used to make cache output different from query string. Multiple query characters are separated by semicolons.
    varybycontrol: Used to make cache output vary with control values .
    varybyheader: used to make the cache output vary with the HTTP header of the request.
    varybycustom: used to make the cache output vary with the browser type or custom string.
    cacheprofile: used in combination with the configuration file.
    location: sets the page's cacheability. The values include any, client, downstream, none, server, and serverandclient.

    example:

    <% @ outputcache duration =" "varybyparam =" "varybycontrol =" "varybyheader =" "varybycustom =" "cacheprofile =" "location =" "%>

    the two essential attributes are duration and varybyparam. If you do not need to specify varybyparam, set the value to none.

  9. How does varybycustom work?

    Varybycustom. We can customize any text required by the output cache. Besides declaring this attribute in the outputcache Command, we have to rewrite the getvarybycustomstring method in the Code declaration block of the global. asax file of the application to specify the output cache behavior for the custom string.

    For example:

    <% @ Outputcache varybyparam = "NONE" varybycustom = "categorypagekey" location = "server" Duration = "43200" %>

    Here, varybycustom is defined as categorypagekey. In Global. asax, we must define the categorypagekey character to create and output the cache behavior. See the following code.

    Public override string getvarybycustomstring (httpcontext context, string Arg)

    {}

    Mainly from this article, for more details, see this article http://www.cnblogs.com/leonjoon/archive/2006/08/27/487747.html

     

  10. How to Use Q =? (Except q = 5) to implement ASP. net html output buffer and buffer expiration (for exampleHttp: // localhost/page. aspx? Q = 5)?

    To be answered by experts.

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.