1.ajax应用
1>Web.config中的<system.web></system.web>之间加入如下代码:
<httpHandlers>
<add path="ajax/*.ashx" verb="POST,GET" type="Ajax.PageHandlerFactory, Ajax" />
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
</httpHandlers>
2>项目中引用ajax.dll
3>程序编写
.cs
public partial class Register : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(Register));
}
[Ajax.AjaxMethod]
public string GexMax(int max1, int max2)
{
if (max1 > max2)
{
return max1.ToString();
}
else
{
return max2ToString();
}
}
}
.aspx
<script>
alert(Register.GexMax(1,2).value);
</script>
2.硬盘中写入文本文件
System.IO.StreamWriter sw = new System.IO.StreamWriter(path, true);
sw.Write(str);
sw.Flush();
sw.Close();
3.硬盘中读出文本文件
string str;
System.IO.StreamReader sr = new System.IO.StreamReader(path);
str = sr.ReadToEnd();
sr.Close();