欢迎光临
我们一直在努力

asp网站源代码_asp网页源码

asp网站源代码_asp网页源码

大家好,很高兴有机会和大家一起探讨asp网站源代码问题。我将用专业的态度回答每个问题,同时分享一些具体案例和实践经验,希望这能对大家有所启发。

文章目录列表:

1.急急急求两个ASP动态网页代码
2.如何运行ASP源代码
3.asp做的网站隐藏源代码
4.帮忙x一个简单的asp网页源代码
5.asp网站源代码
6.急求ASP+ACCESS网站用户注册和登陆的源代码!

asp网站源代码_asp网页源码

急急急求两个ASP动态网页代码

1)asp生成html方式

要生成文件肯空要用到FSO(FileSystemObject)组件,通过asp生成静态网页主要有两种方式:

a、生成的内容由多部分连接而成;

b、生成的内容基于模板生成。

2)方式1:生成的内容由多部分连接而成

步骤

a、设计要输出网页的布局

b、设计生成HTML的asp文件

例子:

输出网页的布局:

<html&gt;

<head>

<title>标题</title>

<style type="text/css">

<!--

.article_title {

font-size: 22px;

font-weight: bold;

text-align: center;

padding-top: 10px;

padding-bottom: 20px;

}

.content {

text-indent: 18px;

font-size: 16px;

line-height: 230%;

text-align: left;

}

.from {

font-size: 14px;

text-align: right;

padding-right: 15px;

padding-top: 15px;

}

.feature_bar {

font-size: 14px;

color: #999999;

text-align: center;

padding-bottom: 15px;

}

-->

</style>

</head>

<body>

<table width="80%">

<tr>

<td><div class="article_title">标题</div>

<div class="feature_bar">作者: 录入时间: 录入: </div>

<div class="content">内容</div>

<div class="from">来源:</div> </td>

</tr>

</table>

</body>

</html>

把源代码中的所有的 " 替换成 "",作用是在ASP中输出双引号。

设计asp文件:

<% Option Explicit %>

<html>

<head>

<title>ASP生成HTML</title>

<style type="text/css">

<!--

.align_right_top {

text-align: right;

vertical-align: top;

}

.align_left_10px {

text-align: left;

padding-left: 10px;

}

-->

</style>

</head>

<body>

<form method="post" action="?action=create">

<table width="80%">

<tr>

<td class="align_right_top" >HTML文件名称:</td>

<td class="align_left_10px"><input name="HtmlFileName" type="text" id="HtmlFileName" /></td>

</tr>

<tr>

<td class="align_right_top" >文章标题:</td>

<td class="align_left_10px"><input name="title" type="text" id="title" /></td>

</tr>

<tr>

<td class="align_right_top">作者:</td>

<td class="align_left_10px"><input name="author" type="text" id="author" /></td>

</tr>

<tr>

<td class="align_right_top">录入:</td>

<td class="align_left_10px"><input name="editor" type="text" id="editor" /></td>

</tr>

<tr>

<td class="align_right_top">输入时间:</td>

<td class="align_left_10px"><input name="EditTime" type="text" id="EditTime" /></td>

</tr>

<tr>

<td class="align_right_top">文章内容:</td>

<td class="align_left_10px"><textarea name="content" cols="55" rows="20" id="content"></textarea></td>

</tr>

<tr>

<td class="align_right_top">来源:</td>

<td class="align_left_10px"><input name="from" type="text" id="from" /></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" name="Submit"_alue="提交" /></td>

</tr>

</table>

</form>

<%

if Trim(Request.QueryString("action"))="create" then

dim title , author , editor , EditTime , content , from , html

title=Trim(Request.Form("title"))

editor=Trim(Request.Form("editor"))

EditTime=Trim(Request.Form("EditTime"))

content=Trim(Request.Form("content"))

from=Trim(Request.Form("from"))

html="<html>"_ '粘贴上面的修改后的 输出网页布局的源代码

&"<head>"_ ‘并用 _ 与 & 把各行连接起来 或删除多余空格使源代码写在一行

&"<title>"&title&"</title>"_

&"<style type=""text/css"">"_

&".article_title {"_

&"font-size: 22px;"_

&"font-weight: bold;"_

&"text-align: center;"_

&"padding-top: 10px;"_

&"padding-bottom: 20px;"_

&"}"_

&".content {"_

&"text-indent: 18px;"_

&"font-size: 16px;"_

&"line-height: 230%;"_

&"text-align: left;"_

&"}"_

&".from {"_

&"font-size: 14px;"_

&"text-align: right;"_

&"padding-right: 15px;"_

&"padding-top: 15px;"_

&"}"_

&".feature_bar {"_

&"font-size: 14px;"_

&"color: #999999;"_

&"text-align: center;"_

&"padding-bottom: 15px;"_

&"}"_

&"</style>"_

&"</head>"_

&"<body> "_

&"<table width=""80%"">"_

&"<tr>"_

&"<td><div class=""article_title"">"&title&"</div>"_

&"<div class=""feature_bar"">作者:"&author&" 录入时间:"&EditTime&" 录入:"&editor&" </div>"_

&"<div class=""content"">"&content&"</div>"_

&"<div class=""from"">来源:"&from&"</div> </td>"_

&"</tr>"_

&"</table>"_

&"</body> "_

&"</html>"

dim HtmlFileName ,HtmlFile , fs , FileStream

HtmlFileName=Trim(Request.Form("HtmlFileName"))

if instr(HtmlFileName,".html")=false then

HtmlFileName="NoName.html"

end if

HtmlFile=Server.M_ath(HtmlFileName)

set fs=CreateObject("Scripting.FileSystemObject")

set FileStream=fs.CreateTextFile(HtmlFile)

FileStream.WriteLine Html

FileStream.close

set FileStream=nothing

resp_e.Write("<script>alert('生成"&HtmlFileName&"文件成功!');history.go(-1);</script>")

end if

%>

</body>

</htm>

把上面的asp文件保存放到服务器上即可运行

3)方式2:生成的内容基于模板生成

思想:

给模板asp传递参数使用“MSXML2.XMLHTTP”读取基于参数传递的asp模板的网页源代码,

再使用FSO组件生成静态网页。

步骤:

a、设计有参数传递的asp模板

b、设计asp控制

设计asp模板:(保存成template.asp)

<% Option Explicit %>

<%

dim HtmlFileName ,title , author , editor ,EditTime ,content ,from

HtmlFileName=Trim(Request.QueryString("HtmlFileName"))

title=Trim(Request.QueryString("title"))

author=Trim(Request.QueryString("author"))

editor=Trim(Request.QueryString("editor"))

EditTime=Trim(Request.QueryString("EditTime"))

content=Trim(Request.QueryString("content"))

from=Trim(Request.QueryString("from"))

%>

<html>

<head>

<title><%= title %></title>

<style type="text/css">

<!--

.article_title {

font-size: 22px;

font-weight: bold;

text-align: center;

padding-top: 10px;

padding-bottom: 20px;

}

.content {

text-indent: 18px;

font-size: 16px;

line-height: 230%;

text-align: left;

}

.from {

font-size: 14px;

text-align: right;

padding-right: 15px;

padding-top: 15px;

}

.feature_bar {

font-size: 14px;

color: #999999;

text-align: center;

padding-bottom: 15px;

}

-->

</style>

</head>

<body>

<table width="80%">

<tr>

<td><div class="article_title"><%= title %></div>

<div class="feature_bar">作者:<%= author %> 录入时间:<%= EditTime %> 录入:<%= editor %> </div>

<div class="content"><%= content %></div>

<div class="from">来源:<%= from %></div> </td>

</tr>

</table>

</body>

</html>

设计asp文件:(保存成html.asp)

<% Option Explicit %>

<html>

<head>

<title>ASP生成HTML</title>

<style type="text/css">

<!--

.align_right_top {

text-align: right;

vertical-align: top;

}

.align_left_10px {

text-align: left;

padding-left: 10px;

}

-->

</style>

</head>

<body>

<form method="post" action="?action=create">

<table width="80%">

<tr>

<td class="align_right_top" >HTML文件名称:</td>

<td class="align_left_10px"><input name="HtmlFileName" type="text" id="HtmlFileName" /></td>

</tr>

<tr>

<td class="align_right_top" >文章标题:</td>

<td class="align_left_10px"><input name="title" type="text" id="title" /></td>

</tr>

<tr>

<td class="align_right_top">作者:</td>

<td class="align_left_10px"><input name="author" type="text" id="author" /></td>

</tr>

<tr>

<td class="align_right_top">录入:</td>

<td class="align_left_10px"><input name="editor" type="text" id="editor" /></td>

</tr>

<tr>

<td class="align_right_top">输入时间:</td>

<td class="align_left_10px"><input name="EditTime" type="text" id="EditTime" /></td>

</tr>

<tr>

<td class="align_right_top">文章内容:</td>

<td class="align_left_10px"><textarea name="content" cols="55" rows="20" id="content"></textarea></td>

</tr>

<tr>

<td class="align_right_top">来源:</td>

<td class="align_left_10px"><input name="from" type="text" id="from" /></td>

</tr>

<tr>

<td colspan="2" align="center"><input type="submit" name="Submit"_alue="提交" /></td>

</tr>

</table>

</form>

<%

function getHTTPPage(url)

dim Http

set Http=server.createobject("MSXML2.XMLHTTP")

Http.open "GET",url,false

Http.send()

if Http.readystate<>4 then

exit function

end if

getHTTPPage=bytesToBSTR(Http.resp_eBody,"GB2312")

set http=nothing

if err.number<>0 then err.Clear

end function

Function BytesToBstr(body,Cset)

dim objstream

set objstream = Server.CreateObject("adodb.stream")

objstream.Type = 1

objstream.Mode =3

objstream.Open

objstream.Write body

objstream.Position = 0

objstream.Type = 2

objstream.Charset = Cset

BytesToBstr = objstream.ReadText

objstream.Close

set objstream = nothing

End Function

%>

<%

if Trim(Request.QueryString("action"))="create" then

dim title , author , editor , EditTime , content , from , html

title=Trim(Request.Form("title"))

editor=Trim(Request.Form("editor"))

EditTime=Trim(Request.Form("EditTime"))

content=Trim(Request.Form("content"))

from=Trim(Request.Form("from"))

'读取传递参数后的模版源代码,地址根据具体情况而定

html=getHTTPPage("http://127.0.0.1/template.asp"_

&"?title="&title&"&editor="&editor&"&EditTime="_

&EditTime&"&content="&content&"&from="&content&"")

dim HtmlFileName ,HtmlFile , fs , FileStream

HtmlFileName=Trim(Request.Form("HtmlFileName"))

if instr(HtmlFileName,".html")=false then

HtmlFileName="NoName.html"

end if

HtmlFile=Server.M_ath(HtmlFileName)

set fs=CreateObject("Scripting.FileSystemObject")

set FileStream=fs.CreateTextFile(HtmlFile)

FileStream.WriteLine Html

FileStream.close

set FileStream=nothing

resp_e.Write("<script>alert('生成"&HtmlFileName&"文件成功!');history.go(-1);</script>")

end if

%>

</body>

</htm>

把template.asp与html.asp 放在同一目录通过服务器运行后即可。

4)结论

通过比较可以看出,通过方式一生成的html文件源代码比较乱,而通过模板生成的html文件源代码跟原先模板的源代码一致。

如何运行ASP源代码

右键点那个装了源代码的文件夹,选择"共享安全",再选择"Web共享"选项卡,点那个"共享文件夹",按确定后,打开浏览器,假如此文件夹名为files,里面首页面名为index.aspx,在地址栏输入"localhost/files/index.aspx"即可看到源码运行结果了.

asp做的网站隐藏源代码

人家看不到你的asp代码的,因为asp代码在服务端已经被解析成html了,是固定的。别人只能看到你的js代码和解析后的html代码。所以你更不需要隐藏。另外,比你厉害,并且支持自由程序的人多得是,没人会觊觎你的代码的,好孩子,以后你会懂得自由精神的!

帮忙x写一个简单的asp网页源代码

如果user表存在并且设计好。

假设字段分别为id,name,classname

那么如下代码即可。

name=request("name")

classname=request("classname")

set rs=server.createobject("adodb.recordset")

rs.open "select * from user",conn,1,3

rs.addnew

rs("name")=name

rs("classname")=classname

rs.update

rs.close

html的表单部分,用你的那2个文本框来输入就可以了。name和classname可以根据你自己的需要来改名。

多动手,祝你成功。

asp网站源代码

局域网搭建一个web服务器,固定该机的内网IP,要win2003系统,XP的不行,因为IIS连接数有限制,搭建好,把程序放上去,其他电脑直接输入这台服务器的IP地址就可以访问了。

如果要外网登陆,要先把局域网的路由器映射到这台服务器上,一般是在路由器里设置DMZ主机,然后填上服务器的内网IP。

外网访问时是要输入外网的IP,可以上IP138查询到。

如果你们宽带是固定IP的话申请域名指向这个IP就行了,如果不是固定IP,就需要使用动态域名,现在常用的是 “花生壳”

急求ASP+ACCESS网站用户注册和登陆的源代码!

你把登录的form的action指向一个asp文件,如check.asp。那么这个文件的内容如下:(注:data.mdb是你的数据库所在目录,login.asp是你成功登录以后所指向的页面,user是数据库里的一个表;表里要有username和password两个字段。)

<%

set conn=Server.Createobject("adodb.connection")adoconn.Open"Driver={Microsoft Access Driver(*.mdb)};DBQ="& _Server.M_ath("data.mdb")

username=request.form("usename")

password=request.form("password")

if username="" or password="" then

resp_e.write ("<script language=javascript>alert'用户名和密码不能为空!';history.go(-1);</script>")

else

set rs=Createobject("adodb.connection")

sql="select * from user"

rs.open.sql conn,1,3

if username=rs("username") and password=rs("password") then

resp_e.redirct "login.asp"

else

resp_e.write ("<script language=javascript>alert'用户名或密码输入错误,请确认!';history.go(-1);</script>")

%>

<%end if%>

<%end if%>

<%

rs.close

set rs=nothing

conn.close

set conn=nothing

%>

你自己调试一下基本上就可以了

好了,今天关于“asp网站源代码”的话题就讲到这里了。希望大家能够对“asp网站源代码”有更深入的认识,并且从我的回答中得到一些帮助。

赞(0)
未经允许不得转载: » asp网站源代码_asp网页源码

评论 抢沙发

评论前必须登录!

 

登录

找回密码

注册

皖ICP备2022015559号-23