Integrating ASP.NET AJAX with SharePoint

Integrating ASP.NET AJAX with SharePoint
上面的文章介绍了ASP. NET AJAX 1.0的使用
如果你的机器安装的是3.5的版本,就需要修改一下了,基本流程一致。

1. Add a <sectionGroup>element to the <configSections>tag:

ContractedBlock.gif ExpandedBlockStart.gif sectionGroup
 <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
 
 

2. Add a <controls> section as a child of the <system.web>/<pages> tag.
  

ContractedBlock.gif ExpandedBlockStart.gif controls
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
3. Add the following tag to the <assemblies> tag, within <compilation>
 
  
< assemblies >
< add assembly ="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</ assemblies >
4. Add some new registrations to the end of the <httpHandlers> section:
ContractedBlock.gif ExpandedBlockStart.gif httpHandlers
 
   
< httpHandlers >
< remove verb ="GET,HEAD,POST" path ="*" />
< add verb ="GET,HEAD,POST" path ="*" type ="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
< add verb ="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path ="*" type ="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
< add verb ="*" path ="*.asmx" validate ="false" type ="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
< add verb ="*" path ="*_AppService.axd" validate ="false" type ="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
< add verb ="GET,HEAD" path ="ScriptResource.axd" type ="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate ="false" />
</ httpHandlers >
5. Add a new registration to the HttpModules section, beneath any existing registrations.

 

  

 

ContractedBlock.gif ExpandedBlockStart.gif httpModules
 
   
< httpModules >
< clear />
< add name ="ScriptModule" type ="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
< add name ="SPRequest" type ="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
< add name ="OutputCache" type ="System.Web.Caching.OutputCacheModule" />
< add name ="FormsAuthentication" type ="System.Web.Security.FormsAuthenticationModule" />
< add name ="UrlAuthorization" type ="System.Web.Security.UrlAuthorizationModule" />
< add name ="WindowsAuthentication" type ="System.Web.Security.WindowsAuthenticationModule" />
< add name ="RoleManager" type ="System.Web.Security.RoleManagerModule" />
<!-- <add name="Session" type="System.Web.SessionState.SessionStateModule"/> -->
</ httpModules >

 6. Add a SafeControl entry for the System.Web.UI namespace from Microsoft Ajax Extensions, within the <SharePoint>/<SafeControls>section:

 
  
< SafeControl Assembly ="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace ="System.Web.UI" TypeName ="*" Safe ="True" AllowRemoteDesigner ="True" />

 7. Finally, add the following configuration tags at the bottom of web.config, near the bottom before the end <configuration> tag.

ContractedBlock.gif ExpandedBlockStart.gif others
 
   
< runtime >
< assemblyBinding xmlns ="urn:schemas-microsoft-com:asm.v1" >
< dependentAssembly >
< assemblyIdentity name ="System.Web.Extensions" publicKeyToken ="31bf3856ad364e35" />
< bindingRedirect oldVersion ="1.0.0.0-1.1.0.0" newVersion ="3.5.0.0" />
</ dependentAssembly >
< dependentAssembly >
< assemblyIdentity name ="System.Web.Extensions.Design" publicKeyToken ="31bf3856ad364e35" />
< bindingRedirect oldVersion ="1.0.0.0-1.1.0.0" newVersion ="3.5.0.0" />
</ dependentAssembly >
</ assemblyBinding >
</ runtime >
< system.webServer >
< validation validateIntegratedModeConfiguration ="false" />
< modules >
< remove name ="ScriptModule" />
< add name ="ScriptModule" preCondition ="managedHandler" type ="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</ modules >
< handlers >
< remove name ="WebServiceHandlerFactory-Integrated" />
< remove name ="ScriptHandlerFactory" />
< remove name ="ScriptHandlerFactoryAppServices" />
< remove name ="ScriptResource" />
< add name ="ScriptHandlerFactory" verb ="*" path ="*.asmx" preCondition ="integratedMode"
type
="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
< add name ="ScriptHandlerFactoryAppServices" verb ="*" path ="*_AppService.axd" preCondition ="integratedMode"
type
="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
< add name ="ScriptResource" preCondition ="integratedMode" verb ="GET,HEAD" path ="ScriptResource.axd" type ="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</ handlers >
</ system.webServer >

 

Adding a ScriptManager into a SharePoint MasterPage

To do this, open up the master page for your site.  Typically, this will be located at <site url>/_catalogs/masterpage.  You can edit this file by opening it in an editor such as Microsoft SharePoint Designer, or directly in Notepad by opening your master page library via DAV (typically \\server\<pathtosite>\_catalogs\masterpage.) 
Add the following into the markup of your page.  A recommended location is right beneath the WebPartManager registration  (search for  <WebPartPages:SPWebPartManager id="m" runat="Server" />):
    <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>

 

转载于:https://www.cnblogs.com/Jack-Chang/archive/2010/02/25/1673546.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值