⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asp深度揭密(下).htm

📁 较为详细的介绍了asp自定义的各种函数,方便asp的各种开发.
💻 HTM
📖 第 1 页 / 共 3 页
字号:
              request.cookies("tuht")("cookies_"&amp;i)&amp;"&lt;br&gt;"<BR>next<BR>%&gt;</P>
              <P>效果:<BR>使用这种方式可以使用201*20=4020个Cookies!!!!</P>
              <P>3.页面过期和缓冲设定<BR>&lt;%<BR>'过期和缓冲处理<BR>response.buffer=true<BR>response.cachecontrol="no-chache"<BR>response.expiresabsolute=now()-1<BR>response.expires=0<BR>%&gt;<BR>html中还可以做设定:<BR>&lt;meta 
              content="no-cache" http-equiv="Pragma"&gt;<BR>&lt;meta 
              HTTP-EQUIV="Expires" CONTENT="0"&gt;</P>
              <P>4.移植性的保证<BR>⑴.包含文件<BR>&lt;!--#include file="top.asp" 
              --&gt;<BR>⑵.使用server.mappath寻找文件路径,避免在页面中直接使用绝对路径<BR>⑶.尽量使用组件封装业务逻辑</P>
              <P>5.调试内部服务器500的错误<BR>⑴.设置IIS显示具体的错误信息<BR>⑵.分步调试,由上而下<BR>⑶.打印某些重要的变量的值,检查是否为我们预期<BR>⑷.根据经验来判断错误</P>
              <P>7. 操作Word文档</P>
              <P>⑴.安装Office 2000,其中Word 
              2000必选<BR>⑵.设置IE中Internet的安全性:ActiveX控件和插件全部启用<BR>⑶.设置工作目录的文件权为Internet及System读取/修改/写入<BR>⑷.编写模版course.dot<BR>⑸.具体代码:<BR>opr_doc_inc.asp<BR>&lt;%<BR>Response.write 
              "Dim Var_Num" &amp; chr(13)<BR>Response.write " Var_Num = 2 " 
              &amp; chr(13)<BR>Response.write "Dim varstrings(2)" &amp; 
              chr(13)<BR>Response.write "varstrings(0)=" &amp; chr(34) &amp; 
              "起草人:" &amp; chr(34) &amp; chr(13)<BR>Response.write 
              "varstrings(1)=" &amp; chr(34) &amp; "日期:" &amp; chr(34) &amp; 
              chr(13)<BR>Response.write "Dim varValues(2)" &amp; 
              chr(13)<BR>Response.write "varValues(0)=" &amp; chr(34) 
              &amp;"起草人:涂海涛"&amp; chr(34) &amp; chr(13)<BR>Response.write 
              "varValues(1)=" &amp; chr(34) &amp; "日期:"&amp;date()&amp; chr(34) 
              &amp; chr(13)<BR>%&gt;</P>
              <P>Sub instead(word)<BR>Set myRange = 
              word.ActiveDocument.Content<BR>for i=0 to Var_Num - 1 <BR>call 
              myRange.Find.Execute(varStrings(i),false,false,false,false,false,false,false,false,varValues(i),2)<BR>Next<BR>End 
              Sub</P>
              <P><BR>opr_doc.asp<BR>&lt;%<BR>'获取保存的路径<BR>path=server.mappath("opr_doc.asp")<BR>path=left(path,len(path)-11)<BR>filenames=path&amp;"test.doc"</P>
              <P>w1="word.activedocument.saveAs"&amp;chr(32)&amp;chr(34)&amp;filenames&amp;chr(34)<BR>w2="wApp.Documents.open"&amp;chr(32)&amp;chr(34)&amp;filenames&amp;chr(34)<BR>%&gt;<BR>&lt;script 
              language="vbscript"&gt;<BR>On Error Resume 
              Next<BR>'生成指定文件名的Word文档<BR>Dim word<BR>set word = 
              CreateObject("Word.Application")<BR>if Err.number &gt; 0 
              Then<BR>Alert "发生错误,请确认文件是否存在"<BR>else<BR>word.visible = 
              False<BR>word.documents.open "&lt;%response.write 
              path%&gt;course.dot"<BR>&lt;%Response.write 
              w1%&gt;<BR>word.documents.close<BR>set word=nothing<BR>end if</P>
              <P>&lt;!--#include file="opr_doc_inc.asp"--&gt;</P>
              <P>Dim wApp<BR>Set wApp = CreateObject("Word.Application")<BR>If 
              Err.number &gt; 0 Then<BR>Alert 
              "发生错误,请确认文件是否正确创建"<BR>else<BR>wApp.visible = 
              True<BR>&lt;%Response.write w2%&gt;<BR>call instead(wApp)<BR>set 
              wApp=nothing<BR>end if<BR>&lt;/script&gt;</P>
              <P>效果:看看生成了doc文件吗?这个新建的doc文件和模版文件有什么区别?起草人和日期发生了变化了吗?保存一下,看看新生成的doc文件的内容。</P>
              <P><BR>附:<BR>1.以上全部代码在Windows 2000 Server SP2+IIS 5.0+MS SQL 
              Server 2000+Office 
              2000下测试通过<BR>2.配置数据库:数据库名course,用户course_user,密码course_password,ODBC驱动为course_dsn,端口为2433,描述表结构的脚本在共享目录下。<BR>3.Asp 
              fileup、Jmail、Winzip 8.1、Winzip command 
              line这几个软件请自行下载。<BR>4.数据库脚本文件:<BR>if exists (select * from 
              dbo.sysobjects where id = object_id(N'[dbo].[output_1]') and 
              OBJECTPROPERTY(id, N'IsProcedure') = 1)<BR>drop procedure 
              [dbo].[output_1]<BR>GO</P>
              <P>if exists (select * from dbo.sysobjects where id = 
              object_id(N'[dbo].[return_1]') and OBJECTPROPERTY(id, 
              N'IsProcedure') = 1)<BR>drop procedure [dbo].[return_1]<BR>GO</P>
              <P>if exists (select * from dbo.sysobjects where id = 
              object_id(N'[dbo].[user_info_1]') and OBJECTPROPERTY(id, 
              N'IsProcedure') = 1)<BR>drop procedure 
              [dbo].[user_info_1]<BR>GO</P>
              <P>if exists (select * from dbo.sysobjects where id = 
              object_id(N'[dbo].[user_info_2]') and OBJECTPROPERTY(id, 
              N'IsProcedure') = 1)<BR>drop procedure 
              [dbo].[user_info_2]<BR>GO</P>
              <P>if exists (select * from dbo.sysobjects where id = 
              object_id(N'[dbo].[user_info_3]') and OBJECTPROPERTY(id, 
              N'IsProcedure') = 1)<BR>drop procedure 
              [dbo].[user_info_3]<BR>GO</P>
              <P>if exists (select * from dbo.sysobjects where id = 
              object_id(N'[dbo].[user_info]') and OBJECTPROPERTY(id, 
              N'IsUserTable') = 1)<BR>drop table [dbo].[user_info]<BR>GO</P>
              <P>CREATE TABLE [dbo].[user_info] (<BR>[id] [int] IDENTITY (1, 1) 
              NOT NULL ,<BR>[user_name] [varchar] (40) COLLATE Chinese_PRC_CI_AS 
              NOT NULL ,<BR>[password] [varchar] (20) COLLATE Chinese_PRC_CI_AS 
              NOT NULL <BR>) ON [PRIMARY]<BR>GO</P>
              <P>ALTER TABLE [dbo].[user_info] WITH NOCHECK ADD <BR>CONSTRAINT 
              [PK_user_info] PRIMARY KEY CLUSTERED <BR>(<BR>[user_name]<BR>) ON 
              [PRIMARY] <BR>GO</P>
              <P>SET QUOTED_IDENTIFIER OFF <BR>GO<BR>SET ANSI_NULLS OFF 
              <BR>GO</P>
              <P>CREATE PROCEDURE [output_1]<BR>@sid int output<BR>AS<BR>set 
              @sid=2<BR>GO<BR>SET QUOTED_IDENTIFIER OFF <BR>GO<BR>SET ANSI_NULLS 
              ON <BR>GO</P>
              <P>SET QUOTED_IDENTIFIER OFF <BR>GO<BR>SET ANSI_NULLS OFF 
              <BR>GO</P>
              <P>CREATE PROCEDURE [return_1]<BR>(@user_name 
              varchar(40),@password varchar(20))<BR>AS<BR>if exists(select id 
              from user_info where user_name=@user_name and 
              password=@password)<BR>return 1<BR>else<BR>return 0<BR>GO<BR>SET 
              QUOTED_IDENTIFIER OFF <BR>GO<BR>SET ANSI_NULLS ON <BR>GO</P>
              <P>SET QUOTED_IDENTIFIER ON <BR>GO<BR>SET ANSI_NULLS OFF 
<BR>GO</P>
              <P>CREATE PROCEDURE [user_info_1]<BR>(@user_name 
              varchar(40),@password varchar(20))<BR>AS<BR>select id from 
              user_info where user_name=@user_name and 
              password=@password<BR>GO<BR>SET QUOTED_IDENTIFIER OFF 
              <BR>GO<BR>SET ANSI_NULLS ON <BR>GO</P>
              <P>SET QUOTED_IDENTIFIER OFF <BR>GO<BR>SET ANSI_NULLS OFF 
              <BR>GO</P>
              <P>CREATE PROCEDURE [user_info_2]<BR>(@user_name 
              varchar(40),@password varchar(20))<BR>AS<BR>SET XACT_ABORT 
              ON<BR>BEGIN TRANSACTION<BR>delete from user_info where 
              user_name=@user_name and password=@password<BR>COMMIT 
              TRANSACTION<BR>SET XACT_ABORT OFF<BR>GO<BR>SET QUOTED_IDENTIFIER 
              OFF <BR>GO<BR>SET ANSI_NULLS ON <BR>GO</P>
              <P>SET QUOTED_IDENTIFIER OFF <BR>GO<BR>SET ANSI_NULLS OFF 
              <BR>GO</P>
              <P>CREATE PROCEDURE [user_info_3] AS<BR>select * from 
              user_info<BR>GO<BR>SET QUOTED_IDENTIFIER OFF <BR>GO<BR>SET 
              ANSI_NULLS ON <BR>GO <BR><BR></P></BLOCKQUOTE></TD></TR>
        <TR>
          <TD class=p4 vAlign=top width="50%">
            <BLOCKQUOTE>原作者:ahyi(转)<BR>来 源:开发者俱乐部<BR>共有5109位读者阅读过此文<BR>【<A 
              href="http://bbs.aspsky.net/list.asp?boardid=1">发表评论</A>】 
            </BLOCKQUOTE></TD>
          <TD class=p4 vAlign=top width="50%">
            <P>
            <LI><FONT color=#0772b1>上篇文章</FONT>:<A 
            href="http://www.aspsky.net/article/list.asp?id=2779">Asp深度揭密(上)</A> 
            <BR>
            <LI><FONT color=#0772b1>下篇文章</FONT>:<A 
            href="http://www.aspsky.net/article/list.asp?id=2781">披著羊皮的大野狼 - 
            Session</A> </LI></TD></TR>
        <TR>
          <TD bgColor=#297dff class=p4 height=20 width="50%"><FONT 
            color=#ceffff>&nbsp;→ 本周热门</FONT></TD>
          <TD bgColor=#297dff class=p4 width="50%"><FONT color=#ceffff>&nbsp;→ 
            相关文章</FONT></TD></TR>
        <TR>
          <TD bgColor=#586011 colSpan=2 height=1><SPACER type="block" 
            width="1"></TD></TR>
        <TR>
          <TD colSpan=2 height=7></TD></TR>
        <TR>
          <TD class=p4 vAlign=top width="50%">
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1510" 
            target=_top title="SQL Server 7.0 入门(一)">SQL Server 7.0 
            入门(...</A>[<FONT color=red>7238</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1540" 
            target=_top title=PHP4实际应用经验篇(1)>PHP4实际应用经验篇(1)</A>[<FONT 
            color=red>7135</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1536" 
            target=_top 
            title=无组件文件上传代码实例(支持多文件上传及文件和input域混合上传)>无组件文件上传代码实例(支持多文件上...</A>[<FONT 
            color=red>6029</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=2557" 
            target=_top title=树型结构在ASP中的简单解决>树型结构在ASP中的简单解决</A>[<FONT 
            color=red>5757</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1545" 
            target=_top title=PHP4实际应用经验篇(6)>PHP4实际应用经验篇(6)</A>[<FONT 
            color=red>5599</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=2563" 
            target=_top title=一个老个写的无组件上传>一个老个写的无组件上传</A>[<FONT 
            color=red>5013</FONT>]<BR>
            <LI><A href="http://www.aspsky.net/article/list.asp?id=1542" 
            target=_top title=PHP4实际应用经验篇(3)>PHP4实际应用经验篇(3)</A>[<FONT 
            color=red>4731</FONT>]<BR></LI></TD>
          <TD class=p4 vAlign=top width="50%">
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2780">Asp深度揭密(下)</A><BR>
            <LI><A 
            href="http://www.aspsky.net/article/list.asp?id=2779">Asp深度揭密(上)</A><BR></LI></TD></TR>
        <TR>
          <TD colSpan=2 height=7></TD></TR></TBODY></TABLE>
    <TD bgColor=#297dff width=1> </TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD bgColor=#297dff height=1><SPACER type="block" 
width="1"></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD align=middle height=30></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
  <TBODY>
  <TR>
    <TD align=middle class=p2 width="100%">
      <TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
        <TBODY>
        <TR>
          <TD align=middle class=p2 width="100%">
            <P align=center><A 
            href="http://www.aspsky.net/produce/index.asp">客户服务</A> -- <A 
            href="http://www.aspsky.net/aspads.asp">广告合作</A> -- <A 
            href="http://www.aspsky.net/about.asp">关于本站</A> -- <A 
            href="http://www.aspsky.net/tell.asp">联系方法</A><BR><BR>动网先锋版权所有 <FONT 
            face=Verdana, size=1 Arial, Helvetica, sans-serif>Copyright &copy; 
            2000-2001 <B>AspSky<FONT color=#cc0000>.Net</FONT></B>, All Rights 
            Reserved .</FONT> 
</P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER></CENTER></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -