我要做个asp.net登陆页面,但不知道 账号密码填写提交 怎么加上。Login.asp代码:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="api.aspx.cs" Inherits="api" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>api.aspx.cs 代码:using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class api : System.Web.UI.Page
{
public int snid=25;//随机码所乘的倍数,请在此修改 protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["Uname"] != null && Request.QueryString["Upass"] != null && Request.QueryString["Ranid"] != null)
{
DataTable dt = new DataTable();
dt = access.GreatDs("select * from userinfo where username='" + re.replace(Request.QueryString["Uname"]) + "' and userpassword='" + re.replace(Request.QueryString["Upass"]) + "'").Tables[0];
if (dt.Rows.Count < 1 )
{
Response.Write("Error,用户名和密码不正确");
Response.End();
return;
}
DateTime endtime = DateTime.Parse(dt.Rows[0]["end_date"].ToString());
if (DateTime.Compare(DateTime.Now,endtime)>0)
{
Response.Write("Error,帐户已经过期,请充值");
Response.End();
return;
} int hid=int.Parse(Request.QueryString["Ranid"]) * snid;
string s = "ok,用户名为" + fun.Encrypt(Request.QueryString["Uname"], 1) + ",密码为";
s += fun.Encrypt(Request.QueryString["Upass"], 1) + ",随机数为";
s += fun.Encrypt(hid.ToString(), 1) + ",服务器当前时间为"; s += DateTime.Now + ",";
Response.Write(s);
Response.Write("到期时间为" + dt.Rows[0]["end_date"].ToString());
Response.Write("绑定的游戏帐号为" + dt.Rows[0]["gameno"].ToString());
Response.End(); }
else
{
Response.Write("Error,参数无效");
Response.End();
}
}
}
请帮我改改 谢谢 我的QQ324747460
解决方案 »
- 求一个把数据库表导出到Excel表的代码
- 关于listView中如何获取于Tag有关的key 急!!!
- C#如何实现SHA512哈希?
- C#如何在一个按钮事件中调用另一个按钮的事件代码?
- C# 怎样控制某个特定的屏保
- 关于窗口被关闭, 但是线程仍然运行的问题。 多谢各位贵人襄助
- 有没有C# 对Web 应用程序、自定义控件、事件比较了解的专家,网上聊聊
- 用C#创建一个COM组件,一定要指定事件的接口吗?
- 如何使程序在进程中隐藏
- C# WINFORM 无法加载 DLL“client.dll”: 找不到指定的模块。
- C#等号两边字符互换
- 多线程数据采:服务器提交协议冲突 Section=ResponseStatusLine
<tr>
<td colSpan="2" height="70"><FONT face="宋体"></FONT></td>
</tr>
<tr>
<td align="right" width="50%" style="height: 15px">登陆用户:</td>
<td noWrap style="height: 15px" align="left"><asp:textbox id="txtUser" runat="server" Width="145px" ForeColor="Black" CssClass="inputText" ></asp:textbox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtUser" ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr> <td style="HEIGHT: 15px" width="50%" align="right">登陆密码:</td>
<td noWrap style="height: 15px" align="left"><asp:textbox id="txtPwd" runat="server"
Width="145px" ForeColor="Black" TextMode="Password" CssClass="inputText"></asp:textbox></td> </tr>
<tr height="40" valign="top">
<td></td>
<td align="center" colSpan="1">
</td>
</tr></table> protected void btn_ok_Click(object sender, ImageClickEventArgs e)
{
if (Page.IsValid)
{
DataTable dt = new DataTable();
dt = access.GreatDs("select * from userinfo where username='" + re.replace(this.txtUser.Text) + "' and userpassword='" + re.replace(txtPwd.Text.Trim()) + "'").Tables[0];
}
}
到51aspx.com里看看代码很多
<head runat="server">
<title>无标题页 </title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr><td>账号</td><td>
<input type="text" id="Uname"/>
</td></tr>
<tr><td>密码</td><td>
<input type="password" id="Upass"/>
</td></tr>
<tr><td></td><td><input type="submit" value="登陆" /></td></tr>
</table>
</div>
</form>
</body>
</html>