Some changes in upgrading ASP. net mvc preview 1 to ASP. net mvc preview 2

Source: Internet
Author: User

Microsoft created three DLL libraries for MVC this time, which are

System. Web. MVC. dll(The main MVC class integrates most of the original mvctoolkit methods );

System. Web. Export actions. dll(Httpcontextbase, httprequestbase, httpresponsebase, The original3.6In versionIhttpcontext, ihttprequest, ihttpresponseClasses evolved from interfaces)

System. Web. Routing. dll(The most common one here isRoutevaluedictionary)

 

Web. config

Compared with the previous version, the MVC preview 2 released this time removes the reference to system. Web. Extensions of version 3.6,

Therefore, all nodes that reference 3.6 must be changed to system. Web. Extensions of version 3.5;

The assemblies node references the three classes mentioned above.

The urlroutingmodule in httpmodules references

<Add
Name="Urlroutingmodule"
Type="System. Web. Routing. urlroutingmodule, system. Web. Routing, version = 3.5.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35"/>

 

Some modifications have been made to define route in global. ascx.

The original format is:

Routetable. routes. Add (NewRoute

{

Url ="[Controller]/[action]/[ID]",

Defaults =New{Action ="Index", Id = (String)Null},

Routehandler =Typeof(Mvcroutehandler)

});

Now changed:

Routetable. routes. Add (New
Route("{Controller}/{action}/{ID }",New
Mvcroutehandler())

{

Defaults =New
Routevaluedictionary(New{Action ="Index", Id = (String)Null}),

});

Here we will talk about a new function. The URL supports a * number. Example:{Controller}/{* afterstring}

For example, the client access URL isHttp: // localhsot/home/Scott/2007/8/2, then the afterstring value obtained in the controller is Scott/2007/8/2.

 

Controller

The attribute of the original [controlleraction] is canceled. I don't know why.

There are basically no other changes, that is, the original mvctoolkits cannot be used, resulting in greatCodeModify question.

MVC2 has just been installed. What new features have not been found. There are too few related online content. You are welcome to discuss it!

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.