
可以检索request对象的servervariables集合的各个属性。
客户端的用户名,是不是指登录OS的用户名?
我想应该是安全方面的原因,servervariables集合中虽然了logon_user及remote_user两个关联用户的属性,但都为空。
如果没有特别需要,可改用IP地址来记录。以下是取得IP地址的方法。
1服务器端IP: requestservervariables("LOCAL_ADDR")
2客户端IP: requestservervariables("REMOTE_ADDR")
'定义变量
Dim ABC="abc变量的数据"
也可以是接收url的值
<%ABC=requestQueryString("abc)%>abc就是接收url变量的
变量用于存储信息。
假如在子程序之外声明变量,那么这个变量可被 ASP 文件中的任何脚本改变。假如在子程序中声明变量,那么当子程序每次执行时,它才会被创建和撤销。
yzm_right = num_1 & num_2 & num_3 & num_4
这一句改为
session("code")=num_1 & num_2 & num_3 & num_4
然后在liuyan_showasp的开头加上:
<%
if session("code")<>request("yzm") then
responsewrite "验证码错误!"
responseend
end if
%>
你可以获取到的值remote_ip_info['city']赋值到页面的隐藏域中<input type="hidden" name="remote_ip_info"> 然后在后台进行接收显示。代码如下:
前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Defaultaspxcs" Inherits="_Default" %><!DOCTYPE html>
<html xmlns=";
后台接收代码:
using System;using SystemCollectionsGeneric;
using SystemLinq;
using SystemWeb;
using SystemWebUI;
using SystemWebUIWebControls;
public partial class _Default : SystemWebUIPage
{
ModelBankOperate _bank = new ModelBankOperate();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void Button1_Click(object sender, EventArgs e)
{
ResponseWrite(Request["remote_ip_info"]ToString());
}
}
显示的效果如下:
<%
'连接数据库略
set rs = connexecute("select FLD_NAME,FLD_ITEM from TBL_Char")
do while not rseof
strname = rs("FLD_NAME")
stritem = rs("FLD_ITEM")
strsql = "update TBL_Char with (UPDLOCK) set FLD_ITEM='" & cvt(stritem) & "' where FLD_NAME='" & strname & "'"
connexecute strsql
rsmovenext
loop
rsclose
'下面是cvt函数
function cvt(strnum)
if len(strnum) >= 34 then
sn = mid(strnum, 33, 2)
sn = hex(eval("&H" & sn) + 1)
sn = right("00" & sn, 2)
cvt = left(strnum, 32) & sn & right(strnum, len(strnum) - 34)
end if
end function
%>
没有name那么request("name")的值就是空字符串啊
dim theName
theName=Request("name")
if theName="" then
'没有name
else
'有name
End if
以上就是关于用asp实现页面加载的时候就获取客户端的用户名并且插入数据库,重点是我怎么能在asp中获取这个变量呢全部的内容,包括:用asp实现页面加载的时候就获取客户端的用户名并且插入数据库,重点是我怎么能在asp中获取这个变量呢、asp如何显示变量的值、asp程序时,怎样将获取的验证码变量(内容是数字)进行判断是否错误等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)