浅谈ASP.NET的内部机制(一)
浅谈ASP.NET的内部机制(二)
浅谈ASP.NET的内部机制(三)
浅谈ASP.NET的内部机制(四)
浅谈ASP.NET的内部机制(五)
浅谈ASP.NET的内部机制(六)
浅谈ASP.NET的内部机制(七)
浅谈ASP.NET的内部机制(八) ......
许久以前,写过一篇《asp.net页中动态加入样式表文件》,后来发现在使用时如果每页都写这么个函数真是很麻烦,于是自己写了一个Page的派生。将这个函数加了进去。
/**//// <summary>
/// 作者 邹健
/// 日期 20070202
/// 重载的Page类。
/// </summary>
public class ChPage : Page {
/**//// <summary>
/// 构造函数。
/// </summary>
public ChPage() { }
/**//// <summary>
/// Render函数。
&nb ......
using System;
using System.Text;
using System.Web;
using System.IO;
namespace Chsword {
/// <summary>
/// 成幻互联缓存类
/// 邹健 2007.5
/// </summary>
class Cache {
TimeSpan _TimeSpan;
/// <summary>
/// 构造函数。自动设置缓存为1小时20分。
/// </summary>
public Cache() {
_TimeSpan = new TimeSpan(0, 1, 20, 0, 0);
}
&n ......
WCF的架构:using System.ServiceModel;
契约:Contract
[ServiceContract]
public partial interface IContract
{
[OperationContract]
string DocumentWebHostUrl();
}
服务:Service
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
public partial class ServiceBusiness : IContract
{
}
代理:Proxy
public partial class Proxy : ClientBase<IContract>, IContract, IDisposable
{
public Proxy()
: base()
{
}
public void EndSession(Guid sessionID)
{
  ......
WCF的架构:using System.ServiceModel;
契约:Contract
[ServiceContract]
public partial interface IContract
{
[OperationContract]
string DocumentWebHostUrl();
}
服务:Service
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
public partial class ServiceBusiness : IContract
{
}
代理:Proxy
public partial class Proxy : ClientBase<IContract>, IContract, IDisposable
{
public Proxy()
: base()
{
}
public void EndSession(Guid sessionID)
{
  ......
一. 使用QueryString变量
QueryString是一种非常简单也是使用比较多的一种传值方式,但是它将传递的值显示在浏览器的地址栏中,如果是传递一个或多个安全性要求不高或是结构简单的数值时,可以使用这个方法。
Response.Redirect( "target.aspx?param1=hello¶m2=hi ")
接收页面: string str = Request.QueryString["param1"];
string str1 = Request.QueryString["param2];
二.使用Cookie对象变量(Cookie是存放在客户端的)
设置Cookie: HttpCookie cookie_name = new HttpCookie("name");
......
在Global.asax
需要回顾的知识点是 线程 和 文本文件的读写。
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading" %>
<script runat="server">
string logpath;
Thread thread;
void writelog()
{
while (true)
{
StreamWriter sw = new StreamWriter(logpath, true, Encoding.UTF8);
sw.WriteLine(thread.Name + ":" + DateTime.Now.ToString());
sw.Close();
Thread.CurrentThread.Join(1000 * 60);
}
}
void ......