Use of the MYMVC framework

Source: Internet
Author: User

1) Add the following code under the System.Web node in Web. config

<pages controlrenderingcompatibilityversion= "4.0" clientidmode= "Autoid" >
<namespaces>
<add namespace= "Mymvc"/>
</namespaces>
</pages>
<add path= "*.cspx" verb= "*" type= "Mymvc.ajaxhandlerfactory,mymvc" validate= "true"/>

2) Add the following code to the <system.webServer> node for compatibility IIs7.0:

<validation validateintegratedmodeconfiguration= "false"/>
<security>
<requestFiltering>
<fileExtensions>
<remove fileextension= ". cspx"/>
<add fileextension= ". Cspx" allowed= "true"/>
</fileExtensions>
</requestFiltering>
</security>
<add name= "Ajaxhandlerfactory" verb= "*" Path= "*ajax*/*.cspx"
Type= "Mymvc.ajaxhandlerfactory, Mymvc" precondition= "Integratedmode"/>

The top is the configuration


For example, in AjaxMenuManager.cs, there are the following methods

Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using Mymvc;
Namespace Lesso.Invoicing.UI.AjaxMethod
{
public class Ajaxmenumanager
{
[Action]
public string Test (string a)
{
return A;
}
}
}

In JS, the method is called as follows:

$.ajax ({
URL: "/lesso.invoicing.ui.ajaxmethod/ajaxmenumanager/test.cspx",

Lesso.Invoicing.UI.AjaxMethod name space; Ajaxmenumanager class name; Test method Name
Data: {A: "2"},
Success:function (responsetext) {
alert (responsetext);
},
Error:function (msg) {
Alert (msg);
}
});

It is important to note that:

The Ajax method prefixes the Ajax ...

MYMVC original article and source code: http://www.cnblogs.com/fish-li/archive/2012/02/12/2348395.html

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.