登录界面aspx源码(asp登录界面代码)
本文目录一览:
- 1、在.net中 如何直接取得aspx页面的html源代码啊?(为了以后导出用)
- 2、asp登录界面源代码
- 3、求ASP登陆界面的源码
- 4、求c#注册登录界面源代码(全部包括SQL数据库)
- 5、为什么有的网站ASPX页面源代码没有恶心的
在.net中 如何直接取得aspx页面的html源代码啊?(为了以后导出用)
不知道你要用什么方式导出,其实导出的方案很多,不一定非要取得整个aspx页面的html源码。
现在在后台获取aspx页面的源代码还是比较麻烦的。
如果你想只获取body里面的内容,可以直接将body里的所有内容都放到一个带服务器标记的div里面
如:
body
div runat="server" id="strContent"
!--这个里面放你的源码--
/div
/body
后台:
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
strContent.RenderControl(hw);
string strHtmlBody=tw.ToString();//这里的即时body里面的html源码
上面这种方式比较简单,但是如果要导出整个html里面的内容就会比较麻烦了
必须重写页面的Render方法,在所有控件渲染的时候获取整个页面的源码。
public string strHtml="";
protected override void Render(HtmlTextWriter writer)
{
StringBuilder ee = new StringBuilder();
StringWriter sw = new StringWriter(ee);
HtmlTextWriter hw = new HtmlTextWriter(sw);
base.Render(hw);
strHtml=ee.ToString();//这里的即时body里面的html源码
}
asp登录界面源代码
default
html
head
meta http-equiv="Content-Language" content="zh-cn"
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
meta name="GENERATOR" content="Microsoft FrontPage 4.0"
meta name="ProgId" content="FrontPage.Editor.Document"
title个人注册/title
script language=vbscript
sub b1_onclick()
if len(trim(form1.t1.value))=0 then
msgbox"请输入你的帐号!",0+48,"提示"
form1.t1.focus
elseif len(trim(form1.t2.value))=0 then
msgbox"请输入你的密码!",0+48,"提示"
form1.t2.focus
else
if isnumeric(form1.t1.value)=true then
msgbox"请输入汉字!",0+48,"重输"
form1.t1.focus
elseif len(trim(form1.t2.value))3 or len(trim(form1.t2.value))8 then
msgbox"密码在3至8位之间!",0+48,"重输"
form1.t2.focus
else
window.open"1.asp","new","toolbar=no,width=280,height=150,menubar=no,scrollbar=no,resizable=0"
form1.submit
end if
end if
end sub
/script
/head
body
pyw9sky天地/p
form method="POST" action="1.asp" name="form1" target="new"
p align="center"font size="6" color="#FF0000" face="隶书"个人注册/font/p
p align="center"font size="4"姓名:/fontinput type="text" name="t1" size="20"/p
p align="center"font size="4"密码:/fontinput type="password" name="t2" size="20"/p
p align="center"input type="button" value="注册" name="B1"input type="reset" value="重写" name="B2"/p
/form
/body
/html
1.asp
%@ language=vbscript %
%
dim x,y,num
num=0
x=request.form("t1")
y=request.form("t2")
response.cookies("user")("name")=x
response.cookies("user")("num")=num
response.cookies("user")("password")=y
response.cookies("user").expires=date()+365
%
html
head
title信息确认/title
/head
body
pyw9sky天地/p
table border="0" width="100%" id="table1" align=center cellspacing=1 bgcolor=#333399
tr bgcolor=#ffffff align=center
td colspan="2" width="100%"信息确认/td
/tr
tr bgcolor=#ffffff align=center
td width="31%"姓名:/td
td width="69%"% = x %/td
/tr
tr bgcolor=#ffffff align=center
td width="31%"密码:/td
td width="69%"% = y %/td
/tr
tr bgcolor=#ffffff align=center
td colspan="2" width="100%" align="center"a target="_blank" href="2.asp"登录/a
font onclick="window.close()" style="cursor:hand"关闭/font/td
/tr
/table
/body
/html
%@ language=vbscript %
html
head
title个人登录/title
script language=vbscript
sub b1_onclick()
if len(trim(form1.t1.value))=0 then
msgbox"请输入你的姓名!",0+48,"提示"
form1.t1.focus
elseif len(trim(form1.t2.value))=0 then
msgbox"请输入你的密码!",0+48,"提示"
form1.t2.focus
else
if isnumeric(form1.t1.value)=true then
msgbox"请输入汉字!",0+48,"重输"
form1.t1.focus
elseif len(trim(form1.t2.value))3 or len(trim(form1.t2.value))8 then
msgbox"密码在3至8位之间!",0+48,"重输"
form1.t2.focus
else
form1.submit
end if
end if
end sub
/script
/head
body
form method="POST" action="3.asp" name="form1" target="_blank"
p align="center"font size="6" color="#FF0000" face="隶书"个人登录/font/p
p align="center"font size="4"姓名;/fontinput type="text" name="t1" size="20"/p
p align="center"font size="4"密码:/fontinput type="password" name="t2" size="20"/p
p align="center"input type="button" value="开始登录" name="B1"input type="reset" value="重新输入" name="B2"/p
/form
/body
/html
3.asp
% @ language=vbscript %
%
dim x,y,nm,pw
x=request.form("t1")
y=request.form("t2")
nm=requset.cookies("user")("name")
pw=requset.cookies("user")("password")
if nmx or pwy then
response.redirect"default.htm"
end if
%
%
dim num
num=request.cookies('user")("num")
if num=0 then
num=1
else
num=num+1
end if
response.cookies("user")("num")=num
%
html
head
title欢迎来访yw9sky/title
/head
body
欢迎% =nm %第% =num %次登录
/body
/html
求ASP登陆界面的源码
%dim db,conn,connstr
db="数据库路劲"
set Conn = server.CreateObject("ADODB.Connection")
connstr="provider=microsoft.jet.oledb.4.0;Persist Security Info=False;data source=" server.MapPath(db)
conn.Open connstr
IF Request("action")="login" Then verifycode=cstr(request("verifycode"))
if cstr(session("verifycode"))verifycode then
session("verifycode")=""
Response.Write("script language=javascriptalert('请输入正确的认证码!');this.location.href='login.asp';/script")
Response.End
else
session("verifycode")=""
end if
user=replace(trim(request.form("uName")),"'","''")
password=replace(trim(request.form("Password")),"'","''")
if instr(user,"%") or instr(user,"#") or instr(user,"?") or instr(user,"|") or instr(user,"'") then
response.write "script language=javascriptalert('您的姓名含有非法字符!');this.location.href='login.asp';/script"
response.end
end if
if instr(password,"%") or instr(password,"#") or instr(password,"?") or instr(password,"|") then
response.write "script language=javascriptalert('您的密码含有非法字符!');this.location.href='login.asp';/script"
response.end
end if
uName=Trim(Request.Form("uName"))
Password=Trim(Request.Form("Password"))
IF uName"" And Password"" Then
SQL="Select * From adminname Where adminname='" uName "'"
Set RS=Server.CreateObject("ADODB.REcordset")
RS.Open SQL,Connstr,1,3
IF Not RS.Eof Then
IF Password=RS("adminpassword") Then
if rs("jb")="高级管理员" then
Session("cwz_youth1710")=uName
Session("cwz_youth1710_zj")=uName
Session("cwz_youth1710_dj")=uName
rs("LoginTimes")=rs("LoginTimes")+1
rs("LoginTime")=now()
rs("LoginIP")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
Response.Redirect "index.asp"
elseif rs("jb")="中级管理员" then
Session("cwz_youth1710_zj")=uName
Session("cwz_youth1710_dj")=uName
rs("LoginTimes")=rs("LoginTimes")+1
rs("LoginTime")=now()
rs("LoginIP")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
Response.Redirect "index.asp"
elseif rs("jb")="低级管理员" then
Session("cwz_youth1710_dj")=uName
rs("LoginTimes")=rs("LoginTimes")+1
rs("LoginTime")=now()
rs("LoginIP")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
Response.Redirect "index.asp"
end if
else
response.write("script language=javascriptalert('密码错误!');this.location.href='login.asp';/script")
response.end
End IF
else
response.write("script language=javascriptalert('用户名不存在!');this.location.href='login.asp';/script")
response.end
End IF
else
response.write("script language=javascriptalert('用户名或密码不能为空!');this.location.href='login.asp';/script")
End IF
End IF Function getcode1()
Dim test
On Error Resume Next
Set test=Server.CreateObject("Adodb.Stream")
Set test=Nothing
If Err Then
Dim zNum
Randomize timer
zNum = cint(8999*Rnd+1000)
Session("verifycode") = zNum
getcode1= Session("verifycode")
Else
getcode1= "img src=""getcode.asp"""
End If
End Function
%
html
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
title韶关学院50周年校庆网站后台管理登陆页面/title
style type="text/css"
!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body,td,th {
font-size: 12px;
}
--
/style/headbodydiv align="center"
table width="770" border="0" cellspacing="0" cellpadding="0"
tr
td height="486" div align="center"
form action="login.asp?action=login" method="post"
table width="300" border="0" cellspacing="0" cellpadding="0"
tr
td width="88" height="30"div align="right"用户名:/div/td
td colspan="2"input type=text name="uName" size=12 maxlength=20 style="background-attachment: scroll; background-repeat: repeat; font-size: 9pt; height: 18; width: 102; background-color: #FFFFFF; border: 1 solid #000000; background-position: none 0%"/td
/tr
tr
td height="30"div align="right"密 码:/div/td
td height="18" colspan="2"input type=password name="Password" size=12 maxlength=16 style="background-attachment: scroll; background-repeat: repeat; font-size: 9pt; height: 18; width: 102; background-color: #FFFFFF; border: 1 solid #000000; background-position: none 0%"/td
/tr
tr
td height="30"div align="right"认证码:/div/td
td width="112" height="30"input class="277d-5fb7-0f5e-612b input" type="text" name="verifycode" size="20" style="background-attachment: scroll; background-repeat: repeat; font-size: 9pt; height: 18; width: 102; background-color: #FFFFFF; border: 1 solid #000000; background-position: none 0%"/td
td width="100"%=getcode1()%/td
/tr
tr
td height="30" colspan="3"div align="center"font color="#000000"
input type=submit value=' 提 交 ' name=Submit style="background-color: #DDDDDD; background-repeat: repeat; background-attachment: scroll; font-size: 9pt; height: 20; width: 50; border: 1px groove #000000; background-position: 0% 50%"
input type=reset value=' 取 消 ' name=Submit style="background-color: #DDDDDD; background-repeat: repeat; background-attachment: scroll; font-size: 9pt; height: 20; width: 50; border: 1px groove #000000; background-position: 0% 50%"
/font/div/td
/tr
/table
/form
/div/td
/tr
/table
/div
/body
/html
求c#注册登录界面源代码(全部包括SQL数据库)
我写了一个登录的程序,界面也做的还可以,写了号几天呢。20分把这么多代码写给你不太可能吧,这里也放不下
为什么有的网站ASPX页面源代码没有恶心的
如果您的控件是拖进去的,那么您可以看到页面"源"生成的代码中button控件属性中并不包含Button1_Click的定义,您知道需要双击button才会在页面“源"中产生Button1_Click的定义,同时会在页面后台文件中生成Button1_Click(sender,object)方法。如果您是直接复制aspx页面文件进去,那么由于您没有同时复制aspx页面的后台文件中的Button1_Click(sender,object)方法,所以会报错为“ASP.admin_borrowbook_aspx”并不包含“Button1_Click”的定义,同byscience所述,您只需要在页面”源“中删掉OnClick="Button1_Click“就可以了,当然你也可以在你的后台文件.aspx.cs 中添加这个事件方法(可以从原来的项目中复制过来)