在浏览器无法查看ASP源代码的原因

在浏览器无法查看ASP源代码的原因,第1张

这个你的描述有点模糊。

1实际上,没有游览器能直接看到asp、aspx、jsp这些动态页面的“源代码”,看到的是他们被服务器端解析成为HTML后的内容。除非使用网络爬虫之类的软件。

2使用客户端response直接输出的方法,依然可以看到内容

3但是我有时候会使用js文件动态生成页面,尤其是使用了extjs这样的类库,这时候你只能看到我的js文件,没办法直观的看到页面结构。

Function ReadThemeHtml(ByVal FilePath)

Dim Fso

Set Fso = ServerCreateObject("ScriptingFileSystemObject")

If Not FsoFileExists(ServerMapPath(FilePath)) Then

ReadThemeHtml = "模板文件不存在!"

Exit Function

End If

Dim openFile,strTemp

Set openFile=FsoOpenTextfile(servermapPath(FilePath)) 'true为不存在自行建立

strTemp = openFileReadAll

Set OpenFile = Nothing

Set Fso = Nothing

ReadThemeHtml = strTemp

End Function

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

<%

set conn=ServerCreateobject("adodbconnection")adoconnOpen"Driver={Microsoft Access Driver(mdb)};DBQ="& _ServerMapPath("datamdb")

username=requestform("usename")

password=requestform("password")

if username="" or password="" then

responsewrite ("<script language=javascript>alert'用户名和密码不能为空!';historygo(-1);</script>")

else

set rs=Createobject("adodbconnection")

sql="select from user"

rsopensql conn,1,3

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

responseredirct "loginasp"

else

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

%>

<%end if%>

<%end if%>

<%

rsclose

set rs=nothing

connclose

set conn=nothing

%>

差不多就这样了。你自己去调试吧。可能有些单词写错了。哈哈。不好意思。如果行就多给点分吧。

default

<html>

<head>

<meta >

请问你的机器安装了IIS么,IIS打开了ASP的支持了么,如果都装好了,asp文件放在IIS设置的web文件夹里

浏览器输入127001,就可以访问了

如果需要读取数据库,web的文件夹的权限要修改成users组有修改权限

读取文本内容你应该能写吧?参阅以下代码:

<%

set fs=servercreateobject("scriptingfilesystemobject")

file=servermappath("readtxt")

set txt=fsopentextfile(file,1,true)

if not txtatendofstream then

line=txtReadAll

responsewrite line & "<br>"

end if

%>

line=txtReadAll'读取文件中的所有数据

line=txtReadLine'从文件中读取N个字节的数据

line=txtRead(N)'从文件中读取一行数据

展示的话最好用jquery:

>

test2asp

<html>

<head>

<title></title>

<meta >

以上就是关于在浏览器无法查看ASP源代码的原因全部的内容,包括:在浏览器无法查看ASP源代码的原因、用asp获取网页的代码,并将相应的代码转化为字符串形式、asp用户登陆源代码及处理页面代码等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/9327652.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-27
下一篇2023-04-27

发表评论

登录后才能评论

评论列表(0条)

    保存