ASP.NETÒ³Ãæ¶ÔÏó
»ñÈ¡ÇëÇóµÄÒ³µÄ HttpRequest ¶ÔÏó¡£
Ò»¡¢HttpRequest Àà
ʹ ASP.NET Äܹ»¶ÁÈ¡¿Í»§¶ËÔÚ Web ÇëÇóÆڼ䷢Ë굀 HTTP Öµ¡£
ÏÂÃæµÄ´úÂëʾÀýʹÓà StreamWriter ÀཫÈô¸É HttpRequest ÀàÊôÐÔÖµµÄֵдÈëÎļþ¡£¶ÔÓÚÊÇ×Ö·û´®ÀàÐ͵ÄÊôÐÔ£¬ÊôÐÔÖµ±»Ð´ÈëÎļþʱ½«±»±àÂëΪ HTML¡£±íʾ¼¯ºÏµÄÊôÐԻᱻÒÀ´Îͨ¹ý£¬¶øÕâЩÊôÐÔ°üº¬µÄ¸÷¸ö¼ü/Öµ¶Ô¶¼»á±»Ð´Èë¸ÃÎļþ¡£
<%@ Page Language="C#" %>
<%@ import Namespace="System.Threading" %>
<%@ import Namespace="System.IO" %>
<script runat="server">
/* NOTE: To use this sample, create a c:\temp\CS folder,
* add the ASP.NET account (in IIS 5.x <machinename>\ASPNET,
* in IIS 6.x NETWORK SERVICE), and give it write permissions
* to the folder.*/
private const string INFO_DIR = @"c:\temp\CS\RequestDetails";
public static int requestCount;
private void Page_Load(object sender, System.EventArgs e)
{
// Create a variable to use when iterating
// through the UserLanguages property.
int langCount;
int requestNumber = Interlocked.Increment(ref requestCount);
// Create the file to contain information about the request.
string strFilePath = INFO_DIR + requestNumber.ToString() + @".txt";
StreamWriter sw = File.CreateText(strFilePath);
try
{
// Write request information to the file with HTML encoding.
&nbs
Ïà¹ØÎĵµ£º
ÌõÐÎÂëÊÇÆù½ñΪֹ×á¢ÊµÓõÄÒ»ÖÖ×Ô¶¯Ê¶±ð¼¼Êõ¡£ÌõÐÎÂë¼¼Êõ¾ßÓÐÒÔϼ¸¸ö·½ÃæµÄÓŵã
¡¡¡¡A£®ÊäÈëËٶȿ죺Óë¼üÅÌÊäÈëÏà±È£¬ÌõÐÎÂëÊäÈëµÄËÙ¶ÈÊǼüÅÌÊäÈëµÄ5±¶£¬²¢ÇÒÄÜʵÏÖ“¼´Ê±Êý¾ÝÊäÈ딡£
¡¡¡¡B£®¿É¿¿ÐԸߣº¼üÅÌÊäÈëÊý¾Ý³ö´íÂÊΪÈý°Ù·ÖÖ®Ò»£¬ÀûÓùâѧ×Ö·ûʶ±ð¼¼Êõ³ö´íÂÊΪÍò·ÖÖ®Ò»£¬¶ø²ÉÓÃÌõÐÎÂë¼¼ÊõÎóÂëÂʵ ......
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
/// <summary>
/// һЩ³£ÓõÄJsµ÷ÓÃ
/// Ìí¼Óаæ˵Ã÷£ºÓÉÓھɰæÆÕ±é²ÉÓÃResponse.Write(string msg)µÄ·½Ê½Êä³öjs½Å±¾£¬ÕâÖÖ
/// ·½Ê½Êä³öµÄjs½Å±¾»áÔÚhtmlÔªËصÄ<html>&a ......
ÉèÖÃÏÂÀ¿òµÄ³õʼֵ£º
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="Сѧ" Value="1"></asp:ListItem>
<asp:ListItem Text="ÖÐѧ" Value="2"></asp:ListItem& ......