ASP.NET 2.0 AJAX中Webservice调用方法示例

简介: ASP.NET 2.0 AJAX中能够在客户端js中很方便地调用服务器Webservice,以下为一些调用的示例。笔者安装的ASP.NET 2.0 AJAX 版本为AJAX November CTP。

ASP.NET 2.0 AJAX中能够在客户端js中很方便地调用服务器Webservice,以下为一些调用的示例。笔者安装的ASP.NET 2.0 AJAX

版本为AJAX November CTP

三个示例分别为:
1 带参数的WS方法
2 不带参数的WS方法
3 参数类型为DataTable的WS方法

一、WebMethod
注意要点:
1 WebMethod类需要添加命名空间 Microsoft.Web.Script.Services,此空间需要引用Microsoft.Web.Preview.dll
2 类声明加入标签 [ScriptService]
3 在Asp.net 2.0里可以直接用DataTable作为返回类型了,但是需要在Web.config文件添加序列化转换器的属性。DataSet、DataTable、DataRow均有转换器

img_a6339ee3e57d1d52bc7d02b338e15a60.gif    < system .web.extensions >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
< scripting >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif      
< webServices >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< jsonSerialization >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif          
< converters >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< add  name ="DataSetConverter"  type ="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview" />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< add  name ="DataRowConverter"  type ="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview" />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< add  name ="DataTableConverter"  type ="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview" />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif          
</ converters >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ jsonSerialization >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif      
</ webServices >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
</ scripting >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif  
</ system.web.extensions >

WEB服务1:WS1

img_a6339ee3e57d1d52bc7d02b338e15a60.gif using  System;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Collections;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.Services;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.Services.Protocols;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  Microsoft.Web.Script.Services;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Data;
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
/**/ /// <summary>
img_33d02437d135341f0800e3d415312ae8.gif
/// WS1 的摘要说明
img_05dd8d549cff04457a6366b0a7c9352a.gif
/// </summary>

img_a6339ee3e57d1d52bc7d02b338e15a60.gif [WebService(Namespace  =   " http://tempuri.org/ " )]
img_a6339ee3e57d1d52bc7d02b338e15a60.gif[WebServiceBinding(ConformsTo 
=  WsiProfiles.BasicProfile1_1)]
img_a6339ee3e57d1d52bc7d02b338e15a60.gif[ScriptService]
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
public   class  WS1 : System.Web.Services.WebService  img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif {
img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
public WS1 () img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
//如果使用设计的组件,请取消注释以下行 
img_33d02437d135341f0800e3d415312ae8.gif        
//InitializeComponent(); 
img_105a1e124122b2abcee4ea8e9f5108f3.gif
    }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif    [WebMethod]
img_33d02437d135341f0800e3d415312ae8.gif    
public string ServerTime()
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif        
return String.Format("now: {0}", DateTime.Now);
img_105a1e124122b2abcee4ea8e9f5108f3.gif    }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif    [WebMethod]
img_33d02437d135341f0800e3d415312ae8.gif    
public DataTable GetDataTable()
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif        DataTable dt 
= new DataTable("Person");
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        dt.Columns.Add(
new DataColumn("Name"typeof(string)));
img_33d02437d135341f0800e3d415312ae8.gif        dt.Columns.Add(
new DataColumn("LastName"typeof(string)));
img_33d02437d135341f0800e3d415312ae8.gif        dt.Columns.Add(
new DataColumn("Email"typeof(string)));
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        dt.Rows.Add(
"kui""he""hekui168@163.com");
img_33d02437d135341f0800e3d415312ae8.gif        dt.Rows.Add(
"ren""chao""chaoren888@163.com");
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
return dt;
img_105a1e124122b2abcee4ea8e9f5108f3.gif    }

img_05dd8d549cff04457a6366b0a7c9352a.gif}

img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif

WEB服务2:WS

img_a6339ee3e57d1d52bc7d02b338e15a60.gif using  System;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Collections;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.Services;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  System.Web.Services.Protocols;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
using  Microsoft.Web.Script.Services;
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
/**/ /// <summary>
img_33d02437d135341f0800e3d415312ae8.gif
/// WS 的摘要说明
img_05dd8d549cff04457a6366b0a7c9352a.gif
/// </summary>

img_a6339ee3e57d1d52bc7d02b338e15a60.gif [WebService(Namespace  =   " http://tempuri.org/ " )]
img_a6339ee3e57d1d52bc7d02b338e15a60.gif[WebServiceBinding(ConformsTo 
=  WsiProfiles.BasicProfile1_1)]
img_a6339ee3e57d1d52bc7d02b338e15a60.gif[ScriptService]
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
public   class  WS : System.Web.Services.WebService  img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif {
img_33d02437d135341f0800e3d415312ae8.gif
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
public WS () img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif        
//如果使用设计的组件,请取消注释以下行 
img_33d02437d135341f0800e3d415312ae8.gif        
//InitializeComponent(); 
img_105a1e124122b2abcee4ea8e9f5108f3.gif
    }

img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif    [WebMethod]
img_33d02437d135341f0800e3d415312ae8.gif    [ScriptMethod(UseHttpGet 
= true)]
img_33d02437d135341f0800e3d415312ae8.gif    
public string HelloWorld(String query)
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif        
string inputString = Server.HtmlEncode(query);
img_33d02437d135341f0800e3d415312ae8.gif        
if (!String.IsNullOrEmpty(inputString))
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            
return String.Format("hello, {0}. ", inputString);
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_33d02437d135341f0800e3d415312ae8.gif        
else
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif        
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif            
return "query string is null or empty";
img_105a1e124122b2abcee4ea8e9f5108f3.gif        }

img_105a1e124122b2abcee4ea8e9f5108f3.gif    }

img_33d02437d135341f0800e3d415312ae8.gif
img_05dd8d549cff04457a6366b0a7c9352a.gif}

img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif

二、前台页面:
注意要点:
需要使用的后台WebService的方法均设置在如下位置

img_a6339ee3e57d1d52bc7d02b338e15a60.gif          < asp:ScriptManager  ID ="ScriptManager1"  runat ="server" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< Services >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
< asp:ServiceReference  Path ="~/WS.asmx"   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
< asp:ServiceReference  Path ="~/WS1.asmx"   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
</ Services >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ asp:ScriptManager >

Default页面:

img_405b18b4b6584ae338e0f6ecaf736533.gif img_1c53668bcee393edac0d7b3b3daff1ae.gif <% img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif @ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< html  xmlns ="http://www.w3.org/1999/xhtml" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< head  runat ="server" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
< title > Untitled Page </ title >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif    
< script  language ="javascript"  type ="text/javascript"  src ="js.js" > img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif
img_05dd8d549cff04457a6366b0a7c9352a.gif    
</ script >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ head >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< body >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
< form  id ="form1"  runat ="server" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< asp:ScriptManager  ID ="ScriptManager1"  runat ="server" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< Services >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
< asp:ServiceReference  Path ="~/WS.asmx"   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
< asp:ServiceReference  Path ="~/WS1.asmx"   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
</ Services >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ asp:ScriptManager >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< div >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< asp:Button  ID ="Button1"  runat ="server"  Text ="Button"  OnClientClick ="dd();return false;"   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< div  id ="time" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
</ div >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< div  id ="List1" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
< asp:DropDownList  ID ="ddl1"  runat ="server"  Width ="187px" >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
</ asp:DropDownList >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
</ div >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ div >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
</ form >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ body >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ html >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif

三、JavaScript程序:
注意要点:
AJAX November CTP 需要用 eval() 方法将其转换成一个DataTable对象(并且要裁掉最前面的"("),而AJAX December CTP 支持以下方法转换“Sys.Preview.Data.DataTable.parseFromJson(result)”

img_a6339ee3e57d1d52bc7d02b338e15a60.gif      function  dd()
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif    
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif {
img_33d02437d135341f0800e3d415312ae8.gif        WS.HelloWorld(   
img_33d02437d135341f0800e3d415312ae8.gif                         'hekui', 
img_33d02437d135341f0800e3d415312ae8.gif                         
function(result) 
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                         
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif
img_33d02437d135341f0800e3d415312ae8.gif                            alert(result); 
img_105a1e124122b2abcee4ea8e9f5108f3.gif                         }
 
img_33d02437d135341f0800e3d415312ae8.gif                     );
img_33d02437d135341f0800e3d415312ae8.gif        WS1.ServerTime(  
img_33d02437d135341f0800e3d415312ae8.gif                         
function(result) 
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                         
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif
img_33d02437d135341f0800e3d415312ae8.gif                            alert(result); 
img_33d02437d135341f0800e3d415312ae8.gif                            
var divTime = document.getElementById("time");
img_33d02437d135341f0800e3d415312ae8.gif                            divTime.innerHTML 
= result;
img_105a1e124122b2abcee4ea8e9f5108f3.gif                         }
 
img_33d02437d135341f0800e3d415312ae8.gif                     );
img_33d02437d135341f0800e3d415312ae8.gif       WS1.GetDataTable(
img_33d02437d135341f0800e3d415312ae8.gif                         
function(result) 
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                         
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                            
// 获取到下拉框控件
img_33d02437d135341f0800e3d415312ae8.gif
                            var List = document.getElementById("ddl1"); 
img_33d02437d135341f0800e3d415312ae8.gif                                                       
img_33d02437d135341f0800e3d415312ae8.gif                            
//AJAX November CTP 需要用 eval() 方法将其转换成一个DataTable对象(并且要裁掉最前面的"(")
img_33d02437d135341f0800e3d415312ae8.gif
                            var Text= result.dataArray.substring(0,result.dataArray.length -1);            
img_33d02437d135341f0800e3d415312ae8.gif                            
var Table = eval( Text);
img_33d02437d135341f0800e3d415312ae8.gif                            
img_33d02437d135341f0800e3d415312ae8.gif                            
//AJAX December CTP 支持以下方法转换
img_33d02437d135341f0800e3d415312ae8.gif//
                            var Table = Sys.Preview.Data.DataTable.parseFromJson(result);
img_33d02437d135341f0800e3d415312ae8.gif
                            
img_33d02437d135341f0800e3d415312ae8.gif                            
//清除下拉框原有列表项
img_33d02437d135341f0800e3d415312ae8.gif
                            for (x=List.options.length-1; x > -1; x--
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                            
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                                List.remove(
0);
img_105a1e124122b2abcee4ea8e9f5108f3.gif                            }

img_33d02437d135341f0800e3d415312ae8.gif                            
img_33d02437d135341f0800e3d415312ae8.gif                            
//从获取的DataTable添加数据到下拉框列表项
img_33d02437d135341f0800e3d415312ae8.gif
                            for (x=0; x < Table.length; x++ )
img_2887d91d0594ef8793c1db92b8a1d545.gifimg_7a2b9a960ee9a98bfd25d306d55009f8.gif                            
img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif{
img_33d02437d135341f0800e3d415312ae8.gif                                
//获取每一行
img_33d02437d135341f0800e3d415312ae8.gif
                                var Row = Table[x];          
img_33d02437d135341f0800e3d415312ae8.gif                                
//创建一个列表项                  
img_33d02437d135341f0800e3d415312ae8.gif
                                var option = document.createElement("option"); 
img_33d02437d135341f0800e3d415312ae8.gif                                
//列表项显示文本赋值
img_33d02437d135341f0800e3d415312ae8.gif
                                option.text = Row.Name + " " + Row.LastName;   
img_33d02437d135341f0800e3d415312ae8.gif                                
//列表项选项值赋值
img_33d02437d135341f0800e3d415312ae8.gif
                                option.value = Row.Email;                      
img_33d02437d135341f0800e3d415312ae8.gif
img_33d02437d135341f0800e3d415312ae8.gif                                
//判断浏览器类型,进行项目添加     
img_33d02437d135341f0800e3d415312ae8.gif
                                if ( window.navigator.appName.toLowerCase().indexOf("microsoft"> -1
img_33d02437d135341f0800e3d415312ae8.gif                                   List.add(option);  
img_33d02437d135341f0800e3d415312ae8.gif                                
else
img_33d02437d135341f0800e3d415312ae8.gif                                   List.add(option, 
null);          
img_105a1e124122b2abcee4ea8e9f5108f3.gif                            }

img_105a1e124122b2abcee4ea8e9f5108f3.gif                         }

img_33d02437d135341f0800e3d415312ae8.gif                       );
img_05dd8d549cff04457a6366b0a7c9352a.gif    }

示例代码:/Files/heekui/AJAXStudy.rar

目录
相关文章
|
7月前
|
开发框架 .NET
ASP.NET Core NET7 增加session的方法
ASP.NET Core NET7 增加session的方法
95 0
|
4月前
|
API
【Azure 媒体服务】Media Service的编码示例 -- 创建缩略图子画面的.NET代码调试问题
【Azure 媒体服务】Media Service的编码示例 -- 创建缩略图子画面的.NET代码调试问题
|
7月前
|
开发框架 前端开发 JavaScript
ASP.NET AJAX使用方法概述(三)
ASP.NET AJAX使用方法概述(三)
56 1
|
4月前
|
XML API 图形学
【Azure Developer】.Net 简单示例 "文字动图显示" Typing to SVG
【Azure Developer】.Net 简单示例 "文字动图显示" Typing to SVG
【Azure Developer】.Net 简单示例 "文字动图显示" Typing to SVG
|
4月前
|
开发框架 中间件 .NET
分享 ASP.NET Core Web Api 中间件获取 Request Body 两个方法
分享 ASP.NET Core Web Api 中间件获取 Request Body 两个方法
168 0
|
4月前
|
开发框架 .NET API
如何在 ASP.NET Core Web API 方法执行前后 “偷偷“ 作一些 “坏“ 事?初识 ActionFilterAttribute
如何在 ASP.NET Core Web API 方法执行前后 “偷偷“ 作一些 “坏“ 事?初识 ActionFilterAttribute
|
4月前
|
开发框架 前端开发 .NET
Asp.net Webapi 的 Post 方法不能把参数加到 URL 中?试试这样写
Asp.net Webapi 的 Post 方法不能把参数加到 URL 中?试试这样写
|
6月前
|
XML API 图形学
.Net 简单示例 "文字动图显示" Typing to SVG “
该文描述了一个.NET API的实现过程,该API能将输入的文字转换成SVG动态图。首先,作者展示了示例网站(&lt;https://readme-typing-svg.demolab.com/&gt;)的功能,它能将文字转化为可自定义样式的SVG动画。接着分析了示例URL的响应,发现其内容类型为`image/svg+xml`,主要由SVG、path、animate和text元素组成。通过创建一个.NET Core Web API项目,作者设置了响应内容类型为`image/svg+xml`,并将示例URL的SVG内容直接输出,成功实现了相同效果。
|
7月前
|
开发框架 缓存 前端开发
安装ASP.NET AJAX (一安装)
安装ASP.NET AJAX (一安装)
113 0
|
7月前
|
XML 开发框架 .NET
C# .NET面试系列八:ADO.NET、XML、HTTP、AJAX、WebService
## 第二部分:ADO.NET、XML、HTTP、AJAX、WebService #### 1. .NET 和 C# 有什么区别? .NET(通用语言运行时): ```c# 定义:.NET 是一个软件开发框架,提供了一个通用的运行时环境,用于在不同的编程语言中执行代码。 作用:它为多语言支持提供了一个统一的平台,允许不同的语言共享类库和其他资源。.NET 包括 Common Language Runtime (CLR)、基础类库(BCL)和其他工具。 ``` C#(C Sharp): ```c# 定义: C# 是一种由微软设计的面向对象的编程语言,专门为.NET 平台开发而创建。 作
329 2
下一篇
DataWorks