on the client side, use document.cookie, see GetCookie() function in the sample code on this URL:http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/cookie.asp
解决方案 »
- 这个SQL语句该怎样写?
- 关于数据库触发器
- winform 简单问题
- SubString取值问题!
- 请教一个字符串的问题
- 怎样把帮助文档(.chm)与c# Winform连接在一起 并定位到某页某一位置呢
- 如何用C++建立一個(Dll),可以讓C#調用其中的方法(來者有分﹐分不夠再加)?
- 请教“表达式包含未定义的函数调用”的问题。
- 较为特殊的一个绘图要求,请高手们指教一下
- CSDN上的朋友给女朋友送花的我打五折...........
- c#也有象java那样丰富的api可以用吗?有没有collection framework?
- 用richtextbox做了一个简单的编辑器,有一个问题请大家帮帮。
public static extern bool InternetGetCookie(
string lpszUrlName,
string lpszCookieName,
out string lpszCookieData,
long dwszie
);
#endregion
public static string GetCookie(string url){
string sb;
InternetGetCookie(url,"",out sb,256);
return sb;
}
using System;
using System.Text;
using System.Runtime.InteropServices;
class TestCookie
{ [DllImport("wininet.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool InternetGetCookie(
string lpszUrlName,
string lpszCookieName,
StringBuilder lpszCookieData,
ref uint lpdwSize
);
[DllImport("kernel32.dll")]
internal static extern Int32 GetLastError(); public static string GetCookie(string url)
{
StringBuilder sb = new StringBuilder(1000);
uint size = 1000;
bool bGood = InternetGetCookie(url,"", sb,ref size);
if (!bGood)
Console.WriteLine("Error code:{0}", GetLastError()); return sb.ToString();
}
public static void Main()
{
Console.WriteLine(GetCookie("http://expert.csdn.net"));
}
}