Analysis of ASP. NET core mechanism in all aspects

Source: Internet
Author: User

 

VISION:

Use c # in the background to write the server (= codebehind)

The front end uses js + ajax for interaction.

Disable the viewstate function.

 

Handler is stateless in nature, so data needs to be imported each time. Now we need to change the development idea.

 

-------------------------------------------------------------------

Http://www.cnblogs.com/artech/archive/2007/04/06/702658.html

Introduction to ASP. NET Postback

 

Click the postback button:

Code <Input type = "hidden" name = "_ EVENTTARGET" id = "_ EVENTTARGET" value = ""/>
<Input type = "hidden" name = "_ EVENTARGUMENT" id = "_ EVENTARGUMENT" value = ""/>
<Input type = "hidden" name = "_ VIEWSTATE" id = "_ VIEWSTATE" value = "/wEPDwUKMTA0NDQ2OTE5OWRk281L4eAk7iZT10hzg + BeOyoUWBQ ="/>

 

 

The Server uses the value of the hidden field of _ EVENTTARGET to find the Control of the Server.

Call the RaisePostBackEvent method of Page.

Code [EditorBrowsable (EditorBrowsableState. Advanced)]
Protected virtual void RaisePostBackEvent (IPostBackEventHandler sourceControl, string eventArgument)
{
SourceControl. RaisePostBackEvent (eventArgument );
}

 

Code Protected virtual void RaisePostBackEvent (string eventArgument)
{
Base. ValidateEvent (this. UniqueID, eventArgument );
If (this. CausesValidation)
{
This. Page. Validate (this. ValidationGroup );
}
This. OnClick (EventArgs. Empty );
This. OnCommand (new CommandEventArgs (this. CommandName, this. CommandArgument ));
}

 

 

In this article, we probably know that, through hiddenfield + input, the server reflection gets the object, and then the specified interface triggers the call. The problem is, is an httpHandler reflection object loaded? Are there still many?

 

Http://www.cnblogs.com/artech/archive/2007/05/21/753620.html

In-depth analysis of one of ASP. NET compilation principles: dynamic compilation (Dynamical
Compilation)

 

A page1 file in asp.net. Dynamic Compilation:

The compiled Type names of Page1 and Page2 are changed to part_ I _page?aspx & Page1 and part_ I _page2_aspx & Page2.

In part_ I _page1_aspx, all the operations required for An aspx-based HttpHandler are defined, and it inherits Page1.

For Http Request of Part I/Page1, all ASP. NET needs to do is generate a part_ I _page+aspx to Handle the request.

There is also a FastObjectFactory that efficiently generates objects. What kind of object is generated? It is actually the Http handler based on each aspx Http request. For Part I/Page1, It is the part_ I _page1_aspx object analyzed in the previous section.

 

A page corresponds to a handler, which contains all the objects of the page (textbox...) and these objects are dynamically generated. Called by reflection.

 

Now we will summarize the entire dynamic compilation process:

 

Step 1: When ASP. NET receives a Request for a Page and tries to find the Preservation File corresponding to the page according to the Url corresponding to the request. If not, recompile all the files to be compiled in the directory where the Page is located, generate some additional files, including the Preservation File.

 

Step 2: parse the Preservation File and use hash and filehash to determine whether the File itself or Dependent File has been modified after the previous compilation. If so, re-compile the File. Then execute Step 2 again.

 

Step 3: Use the assembly attribute Load corresponding to the Preservation File (if the assembly has not been loaded) to obtain the corresponding aspx type through the type, then, use Create_ASP_XXX of FastObjectFactory to create this type. The newly created object is the Http Handler we need. Execute corresponding operations on it to send the Response to the client.

 

-------------------------------------------------------------------

 

Http://www.theserverside.net/tt/articles/showarticle.tss? Id = IIS_ASP

Inside IIS & ASP. NET

IIS communicates with the. NET framework through unmanaged ISAPI extensions: aspnet_isapi.dll and aspnet_filter.dll.

Along with the state Windows service (aspnet_state.exe) and the ASP. NET worker process (aspnet_wp.exe) are the core of the ASP. NET processing model.

<Add verb = "*" path = "*. aspx" type = "System. Web. UI. PageHandlerFactory"/> 

 


Implementing IHttpHandlerFactory

Where HTTP handlers may be useful in responding to requests for specific resources, a handler factory makes it possible to intercept a request, perform some pre-processing on the request, and then following a factory pattern, create the handler for the resource.

 

 

-----------------------------------------------------------------------

Http://msdn.microsoft.com/en-us/library/ms972976.aspx

Understanding ASP. NET View State

 

View state's purpose in life is simple: it's there to persist state when SS postbacks.

 

-----------------------------------------------------------------------

ASP. net mvc entry:

Http://www.cnblogs.com/qleelulu/archive/2008/10/05/1303997.html

/Views/{Controller}/{Action}. aspx

 

The pages of asp.net mvc are actually some <%> for template parsing.

 

Q: In mvc, how does one persist data? For example, how to obtain the text of A txtbox in the background?

Theoretically, it cannot be obtained. Because it is stateless, unless the request is actively sent.

 

-----------------------------------------------------------------------

Http://www.cnblogs.com/jmtek/archive/2006/02/16/331961.html


ASP. NET running mode: PageHandlerFactory

 

 

How does the JS framework interact with the server?

------------------------------------

Http://www.pin5i.com/showtopic-20894.html

Several methods for compiling backend server programs using Asp.net in ExtJS

1. wcf

2. Write An aspx file and perform switchcase on the request string in page_load.

3. inherit httphandler and perform operations by reflecting the method.

 

Http://tech.it168.com/a2010/0106/833/000000833411.shtml

The existing Ajax supports the following classification from the Framework perspective:

· Zero-level, complete base work, including methods to expand the original object, Ajax communication part, relatively simplified.

· Level 1: complete effect, including adding common effect conversion functions, such as tween, drag, maskLayer, and fade.

· Level 2: complete component, including components such as dialog box, list, tree, and calendar.

· Level 3: complete application, including a complete front-end platform, allowing users to define modules that can implement certain functions.

Some frameworks are only zero-level, such as Prototype. js. Some frameworks are level-1, such as jQuery, and some frameworks are level-3, such as Asp.net Ajax and EXT.

Selecting an appropriate Ajax framework can improve program efficiency, reduce development workload, and optimize the display effect.

 

---------------------------------------

 

Ideal Development Framework:

 

1. Use js to implement intelligent parameter return (the Object id required by js + hidden input + Reflection Method body is used to generate callback input parameters)

Private void onclick ()

{

String username = Postback ["id"]; // The Control id is obtained here. When an html page is generated, js is dynamically generated for intelligent callback to achieve high-performance viewstate.

}

2. Use asp.net/c # As the server technology.

It is difficult to maintain versions and associate codes without using asp.net projects. Directly use the class library for writing on the server. Therefore, the factory must be implemented.

Asp.net specifies assembly, classname

The client returns the request Action. aspx, Which is mapped to metod.

 

3.

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.