关于配置 控制面板----添加或删除程序----添加WINDOWS组件-----IIS。添加完成后在你的控制面板-----管理工具----Internet 信息服务,双击图标 左边展开-找到默认网站---右键---新建---虚拟目录(找提示就可以);同样右键的时候---属性-----目录安全性----编辑----匿名访问,允许IIS控制密码。。。
不出意外的话 配置成功了
检测:在你的虚拟目录下新建一个ASP文件 <%=now()%> 浏览显示为当前时间就可以了
呵呵。。。还要注意的一下 你的磁盘的格式,FAT和NTFS两者在文件的保护上有很大差别,相对而言FAT更容易读写文件
关于交互,其实SWF文件再读ASP从数据读出来的数据,SWF也是通过ASP写数据库。
内容:读写数据库(分页),读写COOKIES,读写记事本,SESSION对象
ASP(VB)+FLASH+XML+ACCESS
ASP读数据库:
ASP写数据库:
ASP写COOKIE
不出意外的话 配置成功了
检测:在你的虚拟目录下新建一个ASP文件 <%=now()%> 浏览显示为当前时间就可以了
呵呵。。。还要注意的一下 你的磁盘的格式,FAT和NTFS两者在文件的保护上有很大差别,相对而言FAT更容易读写文件
关于交互,其实SWF文件再读ASP从数据读出来的数据,SWF也是通过ASP写数据库。
内容:读写数据库(分页),读写COOKIES,读写记事本,SESSION对象
ASP(VB)+FLASH+XML+ACCESS
ASP读数据库:
<%@language="VBScript" @codepage="936" %>
<%
'这个声明是编码方式是GB2312的
Option Explicit'显式变量声明
Response.contentType="text/xml"'文档类型XML
Dim conn,connstr,sql,i,rs,ck,label,page,page_size,count,maxPage
i=1
page_size=10
connstr="provider=Microsoft.Jet.OLEDB.4.0;data source="&Server.MapPath("Data.mdb")&";"
Set conn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open connstr
sql="SELECT [ID] from [book]"
rs.open sql,conn,1,1'所有读的都写成1,1 所有写得都写成3,3 是最快查询和写入方式,是达人这样说的
count=rs.RecordCount'获得记录总数
maxPage=count/page_size
rs.close
If count Mod page_size <> 0 Then
maxPage=Int(maxPage)+1
End If
page=trim(Request("page"))
If page="" Then
page=1
End If
If IsNumeric(page)=False Then '检测是不是数字
Response.End'这个也很重要
Else
page=Int(page)
End If
If page<1 Then
page=1
End If
If page>maxPage Then
page=maxPage
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''上面的这段只是为了取得总页数
If page=1 Then
sql="SELECT TOP "&page_size&" * from [book] where (ID <= (select top 1 [ID] FROM [book] ORDER BY ID DESC)) ORDER BY ID DESC"
Else
sql="SELECT TOP "&page_size&" * from [book] where (ID <(select min(ID) from (SELECT TOP "&page_size*(page-1)&" [ID] from [book] order by ID desc))) order by ID desc"' 虚拟表 这样看 SELECT TOP "&page_size*(page-1)&" [ID] from [book] order by ID desc再看select min(ID) from (SELECT TOP "&page_size*(page-1)&" [ID] from [book] order by ID desc)最后看这整个语句
End If
rs.open sql,conn,1,1
Response.Write("<?xml version='1.0' encoding='gb2312'?><book page='"&maxPage&"'>")
Do While Not rs.eof
Response.Write("<part admin='"&rs("admin")&"' name='"&rs("name")&"' title='"&rs("title")&"' QQ='"&rs("QQ")&"' emaill='"&rs("emaill")&"' from='"&rs("from")&"' image1='"&rs("image1")&"' time1='"&rs("time1")&"' image2='"&rs("image2")&"' time2='"&rs("time2")&"' IP='"&rs("IP")&"'><content><![CDATA["&rs("content1")&"]]></content><content><![CDATA["&rs("content2")&"]]></content></part>")
rs.movenext
i=i+1
Loop
Response.Write("</book>")
rs.close
conn.close
Set rs=Nothing
Set conn=Nothing
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&号相当于其他语言的+号
%>
ASP写数据库:
<% @language="VbScript" @codepage="936"%>
<%
Option Explicit
Response.contentType="text/html"
'声明
Dim time1,qq,time2,ck,IP
time1=now()
ck=Request.Form("ck")'接受用POST发送的变量 接受用GET发送的变量的话是ck=Request.QueryString("ck")
time2=Trim(Request.Form("time"))
qq=Trim(Request.Form("qq"))
IP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")'记录IP 取回通过代理服务器访问的IP 并不是所有的服务器都支持
If IP = "" Then
IP = Request.ServerVariables("REMOTE_ADDR")'取回发出远程计算机的IP地址
End If
connstr="provider=Microsoft.Jet.OLEDB.4.0;data source="&Server.MapPath("Data.mdb")&";"
Set conn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open connstr
If ck=1 Then
If massege <> "" Then
sql="INSERT INTO [logbb] ([qq],[IP],[time]) VALUES ('"&qq&"','"&IP&"','"&time1&"')"
End If
If ck=2 Then
sql="DELETE from [logbb where [time]= '"&time2&"'"
End If
If ck=3 Then
sql="UPDATE [logbb] SET [qq]='"&qq&"',[time]='"&time1&"'"
End If
rs.open sql,conn,3,3
Response.Write("flag=1")
Set rs=Nothing
Set conn=Nothing
%>
ASP写COOKIE
<%@language="VBScript" @codepage="936" %> <% Option Explicit'该声明在未输出任何数据之前声明 Response.contentType="text/html" Dim name,qq,emaill,from Response.Cookies("user")("name")=name'user是一个COOKIE的组别 而name是这个组别的键值
<%@language="VBScript" @codepage="936" %> <% Option Explicit Response.contentType="text/xml" '''''''''''继续上演XML Dim webcookie,key Response.Write("<cookie>") For Each webcookie In Request.Cookies If Request.Cookies(webcookie).haskeys Then For Each key In Request.Cookies(webcookie) Response.Write("<user "&key&"='"&Request.Cookies(webcookie) (key)&"'/>") Next End If Next Response.Write("</cookie>") ''''''''''''呵呵'cookie是WEB开发的一个利器 %>
Response.Cookies("user")("QQ")=qqResponse.Cookies("user")("email")=emaillResponse.Cookies("user")("from")=fromResponse.Cookies("user").Expires="July 20, 2010"'重要属性 是COOKIE不是人为删除的情况下的存活日期%>
ASP读COOKIE
<%@language="VBScript" @codepage="936" %> <% Option Explicit Response.contentType="text/xml" '''''''''''继续上演XML Dim webcookie,key Response.Write("<cookie>") For Each webcookie In Request.Cookies If Request.Cookies(webcookie).haskeys Then For Each key In Request.Cookies(webcookie) Response.Write("<user "&key&"='"&Request.Cookies(webcookie) (key)&"'/>") Next End If Next Response.Write("</cookie>") ''''''''''''呵呵'cookie是WEB开发的一个利器 %>
ASP读写记事本 这个案例是一个简单的计数器
<% @language="VBScript" @codePage="936" %> <% Option Explicit Response.contentType="text/xml" Response.Expires=0 Dim fs,txt,counter_file,todayC,yestodayC,highC,MDate,svaeDate,hdate,webcookie,key MDate=right(date(),2) Application.Lock'Application对象是用来保存所有用户的共享信息其方法LOCK,UNLOCK常用来网站的计数器 Set fs = Server.CreateObject("Scripting.FileSystemObject") counter_file=Server.MapPath("count.txt") ''''''''''''''''''''''''''''''''''''''''' Set txt=fs.OpenTextFile(counter_file) Application("tCounter")=txt.ReadLine todayC=Int(txt.ReadLine) yestodayC=Int(txt.ReadLine) highC=Int(txt.ReadLine) svaeDate=txt.ReadLine hdate=txt.ReadLine txt.Close ''''''''''''''''读记事本'''''''''''''''''' If IsEmpty(Session("conn")) Then Application("tCounter")=Application("tCounter")+1 If svaeDate <> MDate Then If todayC > highC Then highC=todayC hdate=DateAdd("d",-1,Date()) End If yestodayC=todayC todayC=1 Else todayC=todayC+1 End If ''''''''''''''''''''''''''''''''''''''''' Set txt=fs.OpenTextFile(counter_file,2,true) txt.WriteLine(Application("tCounter")) txt.WriteLine(todayC) txt.WriteLine(yestodayC) txt.WriteLine(highC) txt.WriteLine(MDate) txt.WriteLine(hdate) txt.Close ''''''''''''''写记事本''''''''''''''''''''' End If Set txt=Nothing Set fs=Nothing Application.Unlock Session("conn")=True '---------------输出猪头的文档--------------- Response.Write("<?xml version='1.0' encoding='gb2312'?><count tC='"&todayC&"' yC='"&yestodayC&"' hC='"&highC&"' hd='"&(hdate)&"' tCount='"&Application("tCounter")&"'/>") %>
呵呵 下面就是在FLASH里摆弄了 做完这些需要注意的是乱码 因为我电脑不知道为什么不能用UTF-8所以只好用GB2312呵呵 所以在FLASH里每次读取或发送数据的时候都要System.useCode=true;这样写的弊端是在不是中文的操作系统下观看时任是乱码 。。。。而UTF-8就不会有这样的情况了 ,呵呵 凡事有利也有弊端,当然UTF-8就是不管是一个汉字还是一个英文字母都以两个字节存贮的
至于UTF-8的用法是 所有的ASP文件另存为UTF-8格式,所有的页面声明是65001 XML的声明是UTF-8 在FLASH里不要用System.useCode=true
FLASH读取ASP数据:
var bookXml:XML;
bookXml.load("book.asp?page="+page+"&rand="+Math.random());
哈哈 或许奇怪 怎么就一句话 其实也就是一句话的事,因为载入进来了就是在解析XML的 至于页数全是由上面的page来决定的只要你在页数的按钮上设置page参数就可以了 至于"&rand="+Math.random()是为了防止读缓存 至于更多的细节就需要自己设计了
FLASH发送数据:
submit_btn.onRelease = function() { status_txt.text = "正在提交数据。。请稍后。。。"; bsend_mc._visible = true; var send_lv:LoadVars = new LoadVars(); var result_lv:LoadVars = new LoadVars(); result_lv.onLoad = function(success) { if (success) { if (this.flag == 1) { status_txt.text = "发送成功"; } else { status_txt.text = "发送失败!"; } } else { status_txt.text = "连接失败"; } bsend_mc._visible = false; }; send_lv.title = title_txt.text; send_lv.qq = qq_txt.text; send_lv.name = name_txt.text; send_lv.content1 = content_txt.text; send_lv.emaill = emaill_txt.text; send_lv.from = from_txt.text; send_lv.ck = 1; //这是为了让ASP辨别应该执行那个SQL查询 send_lv.sendAndLoad("dbook.asp?rand="+Math.random(),result_lv,"POST"); //+++++++++++++++++lujing++++++++++++++++ }
如果实现无刷新的效果 那么应该在status_txt.text = "发送成功";后加上调用载入读数据库的那个页面的语句。。。。。。。。。
完毕 ,当然肯定有很多不完善的地方,恳请大家多多批评指正 。。。。。。
如果你能在这上面有点收获我会倍感欣慰。。。。。。