asp.net form ÑéÖ¤ÎÊÌâ
²âÊÔ¹¤³Ì£º
Login.aspx
Default.aspx
First.aspx
Second.aspx
web.config
Global.asax
´úÂ룺
Login.aspx
C# code:
protected void Submit_Click(object sender, EventArgs e)
{
if ((this.UserEmail.Text == "1") && (this.UserPass.Text == "2"))
{
//Create Authentication Ticket
FormsAuthenticationTicket authTicket = new
FormsAuthenticationTicket(1,
this.UserEmail.Text.Trim(),
DateTime.Now,
DateTime.Now.AddMinutes(HttpContext.Current.Session.Timeout),
this.Persist.Checked,
this.UserEmail.Text.Trim(), "/");
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
authCookie.Expires = DateTime.Now.AddMinutes(HttpContext.Current.Session.Timeout);
Response.Cookies.Add(authCookie);
Response.Redirect("Default.aspx");
}
else
this.Msg.Text = "Invalid credentials. Please try again."
Ïà¹ØÎÊ´ð£º
ÎÒÔÚÒ»¸öASPXÒ³ÃæÖÐÓà <!-- #include file="top.asp"-->ǶÌ×ÁËÒ»¸öaspÒ³Ãæ£¬µ«ÔÚµã»÷°´Å¥Ìá½»±íµ¥µÄʱºòûÓÐÈκη´Ó¦£¬ÊDz»ÊÇÁ½¸öFORMµÄÔÒòÔì³ÉµÄ£¬top.aspÀïÃæÒ²ÓÐÒ»¸öform£¬°ÑǶÌ×È¥µôµÄ»°£¬ÔËÐÐ ......
ǰ¶Îʱ¼äÅöµ½Ò»µÀÃæÊÔÌâÈçÏ£º
test.aspxÒ³ÃæÓÐÈçÏ´úÂ룺
Response.Write(Test.GetDate());
TestÀàÈçÏ£º
public class Test
{
static string dt="";
public static s ......
ÎÒÒѽ«Windows¿Ø¼þ³É¹¦Ó¦ÓÃÓÚAsp.netÖУ¬µ«Õâ¸ö¿Ø¼þ»¹Òª·ÃÎÊÊý¾Ý¿â¡¢½øÐб¾µØIO²Ù×÷¡¢´òÓ¡µÈ£¬Õâʱ¾Í»á³öÏÖ¡°Ó¦ÓóÌÐòÊÔͼִÐа²È«²ßÂÔ²»ÔÊÐíµÄ²Ù×÷¡±ÕâÑùµÄÌáʾ£¬Ó¦¸ÃÔõÑù¸øËüÊÚȨ£¿
ÔÚ¿Í»§¶ËÒªÅäÖÃ,ÔÊÐí¿Í»§¶ËÈ ......
ËÖªµÀ£¬×îºÃÊÇʵÀý£¬²âÊÔ¹ýµÄ¸üºÃ£¬Ð»Ð»·ÖÏí£»
http://www.92dotnet.com/showtopic-428.aspxC# code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using Sy ......
ASP.NET ´íÎó ÎÞ·¨Ê¶±ðµÄ±ê¼Çǰ׺»òÉ豸ɸѡÆ÷¡°asp¡±
´úÂëÈçÏ£º
<%@ Page Language="C#" ContentType="text/xml" AutoEventWireup="true" CodeFile=" ......