Asp.NetÖгÉÔ±¡¢½ÇÉ«ÅäÖÃ
Asp.NetÖгÉÔ±¡¢½ÇÉ«ÅäÖõľßÌå²½Ö裺
1£©×öºÃÍøÕ¾¹æ»®£¬·ÃÎÊȨÏÞÏàͬµÄÒ³Ãæ·Åµ½Í¬Ò»¸öÎļþ¼ÐÖУ»
2£©ÓÃC:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe½«³ÉÔ±×ʸñÓë½ÇÉ«¹ÜÀíµÄÊý¾Ý¿â²¢ÈëÍøÕ¾Êý¾Ý¿â
3£©ÐÞ¸ÄÍøÕ¾µÄÅäÖÃÎļþweb.config£¬Ê¾ÀýÈçÏ£º
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<!-- Êý¾Ý¿âÁ¬½Ó×Ö´® -->
<add name="HappyBookShopConnectionString" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=db_CRM;uid=sa;pwd=sa" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<!-- ²ÉÓÃFormÉí·ÝÑ鷽ʽ -->
<authentication mode="Forms">
<forms loginUrl="~/login.aspx" defaultUrl="~/default.aspx">
</forms>
</authentication>
<!-- ×Ô¶¨Òå³ÉÔ±×ʸñÅäÖòÎÊý -->
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" connectionStringName="HappyBookShopConnectionString" ---/>
</providers>
</membership>
<roleManager enabled="true">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" connectionStringName="HappyBookShopConnectionString" ---/>
</providers>
</roleManager>
<compilation debug="true"/>
</system.web>
</configuration>
¾ßÌå¿É²ÎÕÕC:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
4
Ïà¹ØÎĵµ£º
µÚÒ»£º
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
µÚ¶þ£º
private void Button2_Click( object sender, System.EventArgs e )
{ ......
×î½ü£¬Òª°ÑÒ»¸öC/S½á¹¹µÄ³ÌÐò¸Ä³ÉB/S½á¹¹¡£ÆäÖоÍÓöµ½ÁË´òÓ¡µÄÎÊÌâ¡£Ñо¿ÁËһϣ¬webÏ´òÓ¡·½·¨´ó¸ÅÓÐÕâô¼¸ÖÖ£º
1¡¢ÀûÓÃIEÖ±½Ó´òÓ¡£¬ÕâÖÖ·½Ê½×î·½±ã£¬µ«ÊÇ¿ØÖÆÄÜÁ¦½Ï²î¡£
2¡¢ÀûÓÃACTIVE¿Ø¼þ£¬¿ÉÒÔ×Ô¼º×öÒ»¸öIEµÄ¿Ø¼þÀ´¿ØÖÆ´òÓ¡¡£
3¡¢Ë®¾§±¨±íµÈµÚÈý·½¹¤¾ß£¬¹ºÂò¼Û¸ñ°º¹ó¡£
¸ù¾ÝÎÒµÄÐèÇóÇé¿ö£¬ÓÃIEÖ ......
1. ÔÚASP.NETÖÐרÓÃÊôÐÔ£º
»ñÈ¡·þÎñÆ÷µçÄÔÃû£ºPage.Server.ManchineName
»ñÈ¡Óû§ÐÅÏ¢£ºPage.User
»ñÈ¡¿Í»§¶ËµçÄÔÃû£ºPage.Request.UserHostName
»ñÈ¡¿Í»§¶ËµçÄÔIP£ºPage.Request.UserHostAddress
2. ÔÚÍøÂç±à³ÌÖеÄͨÓ÷½·¨£º
»ñÈ¡µ±Ç°µçÄÔÃû£ºstatic System.Net.Dns.GetHostName()
¸ù¾ÝµçÄÔÃûÈ¡³öÈ«²¿IPµØÖ ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections;
using System.Data.SqlClient;
namespace DAL
{
/// <summary>
/// Êý¾Ý¿âµÄͨÓ÷ÃÎÊ´úÂë
/// ´ËÀàΪ³éÏóÀ࣬²»ÔÊÐíʵÀý»¯£¬ÔÚÓ¦Óà ......
ASP.NETÉú³É¾²Ì¬Ò³
ºËÐļ¼Êõ£º
HTMLPageÎļþ¼Ð£¬ModelHTML.htmÎļþÖеÄArticleTitle,ArticleContent¶¼ÊÇÒªÌæ»»µÄÇøÓò
WriteFile(dr["ArticleTitle"].ToString(), dr["ArticleContent"].ToString(), dr["ID"].ToString());
1.ǰ̨
<head runat="server">
<title>ASP.NETÉú³É¾²Ì¬ÍøÒ³</title>
& ......