ajax 安全性
完全适用ASP.NET的认证机制
–可以使用FormsAuthentication
•WebService方法可以操作Cookie
–Impersonation
–PrincipalPermission
WebService7.cs Code
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
/// <summary>
/// WebService7 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class WebService7 : System.Web.Services.WebService {
public WebService7 () {
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
if (!HttpContext.Current.User.Identity.IsAuthenticated)
{
throw new ApplicationException("please Login In");
}
return "Hello "+HttpContext.Current.User.Identity.Name;
}
}
Default8.aspx Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default8.aspx.cs" Inherits="Default8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat=server ID="aaa" ScriptMode=Debug>
<Services>
<asp:ServiceReference Path="WebService7.asmx" />
</Services>
</asp:ScriptManager>
<mce:script language=javascript type="text/javascript"><!--
function GetMessage()
{
WebService7.HelloWorld(getresult);
}
function getresult(result)
{
alert(result);
}
// --></mce:script>
<input id="Button1" type="button" value="button" on
相关文档:
XMLHttpRequest 对象使 AJAX 成为可能。
XMLHttpRequest
XMLHttpRequest 对象是 AJAX 的关键。
该对象在 Internet Explorer 5.5 与 2000 年 7 月发布之后就已经可用了,但是在 2005 人们开始讨论 AJAX 和 Web 2.0 之前,这个对象并没有得到充分的认识。
创建 XMLHttpRequest 对象
不同的浏览器使用不同的方法来创建 ......
Ajax中send方法参数的使用
一般情况下,使用Ajax提交的参数多是些简单的字符串,可以直接使用GET方法将要提交的参数写到open方法的url参数中,此时send方法的参数为null。
例如 :
var url = "login.jsp?user=XXX&pwd=XXX";
xmlHttpRequest.open("GET",url, ......
刚调试程序的时候报错后然后找的解决方法,现在发出来大家借鉴。
-----------------------
错误提示:
运行时错误 800a01b6
对象不支持此属性或方法: Response.CharSet
---------------------------------------------------------------------
(百度一下,还有很多人遇到同样的错误)
Micros ......
以下引用自 MSDN Magazine:
不论好坏,UpdatePanel 控件都是 ASP.NET AJAX 社区所喜爱的。我说“好”,是因为 UpdatePanel 使部分页面呈现变得相当简单,而说“坏”,是因为它的简便和易用性是以效率和令人啼笑皆非的带宽为代价的。
UpdatePanel 可以为一般的网页带来 AJAX 神奇的好处,但是它不能提 ......
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat=" ......