Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c#ÖеÄAjaxÉÏÊÖƪ£­£­£­·Çͬ²½ÇëÇóresponseXML

ÉÏƪ½éÉÜÁËÈçºÎÔÚAjax¿Í»§¶ËÓë·þÎñÆ÷¶ËÖ®¼ä´«Ëͼòµ¥µÄÎı¾Êý¾Ý£¬Æäʵ£¬Ò²¿ÉÒÔʹÓÃXML×÷ΪÊý¾Ý´«ËÍ¡¢¹µÍ¨µÄ¸ñʽ£¬Ajax¿Í»§¶ËÈôÒª·¢ËÍXML£¬»ù±¾ÉϾÍÊǽ«XML×÷Ϊ×Ö·û´®£¬ÔÚPOSTÇëÇóʱ·¢ËÍ£¬ÀýÈ磺
*HelloAjax.js
var xmlHttp;
function createXMLHttpRequest() {
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
function prepareXML() {
var xml = "<skills>";
var options = document.getElementById("skills").childNodes;
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option.selected) {
xml = xml + "<skill>" + option.value + "<\/skill>";
}
}
xml = xml + "<\/skills>";
return xml;
}
function handleSkills() {
var xml = prepareXML();
var url = "Handler1.ashx?timeStamp=" + new Date().getTime();
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("POST", url);
xmlHttp.setRequestHeader("Content-Type", "text/xml");
xmlHttp.send(xml);
}

ÔÚÉÏÀýÖУ¬½«¿Í»§¶ËÔÚ¶àÑ¡ÔñÏÂÀ­¿òÖÐÑ¡ÔñµÄÊý¾Ý£¬ÒÔÏÂÁеÄXML¸ñʽ·¢ËÍ£º
<skills>
<skill>java</skill>
<skill>vb</skill>
<skill>csharp</skill>
</skills>

·þÎñÆ÷¶Ë²ÉÓÃHttpHandlerʵÏÖ£¬ÔÚ·þÎñÆ÷¶Ë½ÓÊÕµ½XMLÖ®ºó£¬Õë¶ÔXML¼ÓÒÔÆÊÎö£¬È¡µÃÿ¸öNODEÊý¾Ý¡£
²¢»áÒÔÁíÒ»¸öXMLÎļþÖØз¢»Ø¿Í»§¶Ë¡£
*Hanler1.ashx
using System.Text;
using System.Web;
using System.Xml;
using System.Globalization;
namespace HelloAjax
{
public class Handler1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
if (Request.InputStream.Length != 0)


Ïà¹ØÎĵµ£º

c# SQLÊý¾Ý¿âÔ¶³ÌÁ¬½Ó¼°ÅäÖ÷½·¨

Ò»£ºC# Á¬½ÓSQLÊý¾Ý¿â
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
Server=myServerAddress;Database=myDataBase;User ID=myUse ......

VS2005 ʹÓÃAJAXÖ±½Óµ÷Óúǫ́·½·¨

Ê×Ïȶ¼ÊÇʹÓÃVS.Net2005´´½¨Ò»¸ö ASP.Net AJAX-Enabled Web Application
 1¡¢Ê¹ÓÃAJAXÖ±½Óµ÷Óúǫ́·½·¨£º
ºǫ́´úÂ룺
namespace AJAX1
{
    public partial class _Default : System.Web.UI.Page
    {
        // ÐèÒª±êʶΪWebMethod ......

³õʶAjax¼¼Êõ2


 ÊµÏÖ×¢²á½çÃæÎÞË¢ÐÂÅжÏÖØÃû£¬ÓÉÓÚÒª·ÃÎÊÊý¾Ý¿â£¬ËùÒÔÒª´ïµ½ÎÞˢУ¬Ö»ÄÜÓÃAjax¼¼Êõ¡£
 ÆäÖÐ×îÖØÒªµÄ¾ÍÊÇxmlHttp¶ÔÏó¡£
XmlHttpÊÇʲô£¿
×îͨÓõĶ¨ÒåΪ£ºXmlHttpÊÇÒ»Ì׿ÉÒÔÔÚJavascript¡¢VbScript¡¢JscriptµÈ½Å±¾ÓïÑÔÖÐͨ¹ýhttpЭÒé´«ËÍ»ò´Ó½ÓÊÕXML¼°ÆäËûÊý¾ÝµÄÒ»Ì×API¡£XmlHttp×î´óµÄÓô¦ÊÇ¿ÉÒÔ¸üÐÂÍøÒ³µ ......

AjaxµÄ¼òµ¥Ó¦ÓÃ

ǰ̨´úÂ룺
<head runat="server">
    <title>ÎÞ±êÌâÒ³</title>
    <script src="Ajax.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div&g ......

C Sharp(C#)ÖÐÈçºÎɾ³ýÎļþ(Îļþ¼Ð)

C Sharp(C#)ÖÐÈçºÎɾ³ýÎļþ(Îļþ¼Ð)
Ö±½Óɾ³ý:
using System.IO;
...
string filePath = @"D:\...\xxx.xxx";

if (File.Exists(filePath))
{
File.Delete(filePath);
}
else
{
Console. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ