您的位置:首页 > 编程语言 > ASP

ASP.net使用Form验证时Ajaxpro的配置

2010-03-29 09:01 453 查看
在不使用ASP.net的Form验证时,我们配置AjaxPro只需要在System.web的httpHandlers中加入以下代码即可:

<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>

但是如果我们使用了Form验证以上代码却不起作用了,这是因为Form验证涉及到了访问权限的问题,因此需要在Web.config中重新配置,给用户赋予权限,以下是具体配置情况及代码:

首先,在configSections中加入以下代码:

<sectionGroup name="ajaxNet">
<section name="ajaxSettings" type="AjaxPro.AjaxSettingsSectionHandler,AjaxPro.2" requirePermission="false" restartOnExternalChanges="true"/>
</sectionGroup>
其次,在<configuration>中加入以下代码:

<ajaxNet>
<ajaxSettings>
<urlNamespaceMappings useAssemblyQualifiedName="false" allowListOnly="false">
</urlNamespaceMappings>
<jsonConverters includeTypeProperty="true">
</jsonConverters>
<debug enabled="false"/>
<token enabled="false" sitePassword="password"/>
</ajaxSettings>
</ajaxNet>

最后为AjaxPro赋予权限,代码如下:

<location path="ajaxpro">
<system.web>
<httpHandlers>
<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>
</httpHandlers>
<authorization >
<allow users ="*"/>
</authorization>
</system.web>
</location>

这样配置后即可在Form验证时正常使用AjaxPro

如有错误,还望大家指点!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: