为了您的帐号安全,请您通过网易登录!
近期在修改一个网址导航站,大部分页面修改的差不多了,然多邮箱登陆的时候这个网易无法进入:为了您的帐号安全,请您通过网易登录!
如果您通过其它站点登录过,请您及时修改密码。
留下问题待以后解决吧
163邮箱快速登录限制的 测试
无非就是 form 的action属性,还有就是输入用户名/密码的变量的那么属性。
action填要提交到的网页,变量name属性要和原始登录的页面的相同,他才能识别出来。
有的还要特殊变量,如163的url 控件。
163邮箱的代码如下,其他的可以参考 www.hao123.com 的做法。
<form action="http://reg.163.com/CheckUser.jsp">
<INPUT type=hidden name=url value="http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=15">
<INPUT type=hidden value='' name=enterVip>
163邮箱用户名<INPUT type=Text name=username>
密码<INPUT type=password name=password>
<input type=submit value=" 登录 ">
</form>
<form action="http://reg.163.com/login.jsp">
<input type=hidden name=url value="http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=15">
<input type=hidden name=type value="1">
163邮箱用户名<INPUT type=Text name=username>
密码<INPUT type=password name=password>
<input type=submit value=" 登录 ">
</form>
可能是163做了域名检测了,以上代码在本机测试可以,但保存到htm文件传上服务器测试就不行了。
=================================
好像是可以通过 Page.Request对象的属性来做到这种限制域名功能的。
所以写了个测试,看是不是这样。
---------静态页面的代码------------------------------------------------
<form action="http://yjc17-1.at.vwdhosting.net/" method ="post">
<INPUT type=hidden name=url value="http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=15">
<INPUT type=hidden value='' name=enterVip>
163邮箱用户名<INPUT type=Text name=username>
密码<INPUT type=password name=password>
<input type=submit value=" 登录 ">
</form>
---------------------------------------------------------
-------------.NET的动态页面的代码,就是打印Request信息而已----------------------------
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Page.Response.Write ( "Request.Applicati<br>");
Page.Response.Write ( "Request.Path="+Page.Request.Path+"<br>");
Page.Response.Write ( "Request.UserAgent="+Page.Request.UserAgent+"<br>");
Page.Response.Write ( "Request.UserHostName="+Page.Request.UserHostName+"<br>");
Page.Response.Write ( "Request.UserHostAddresst="+Page.Request.UserHostAddress +"<br>");
Page.Response.Write ( "Request.UserHostAddresst="+Page.Request.Browser.ToString ()+"<br>");
Page.Response.Write ( "Request.UrlReferrer="+Page.Request.UrlReferrer +"<br>");
//Page.Request.UrlReferrer的说明:获取有关客户端上次请求的 URL 的信息,该请求链接到当前的 URL。
}
----------------------------------------------------------------------------------------------
然后我把作成的动态页面放到这个地址http://www.474150.net/
静态页面保存到本机的index.htm文件上。
我直接在浏览器中打开http://www.474150.net/ 和
我在本机运行index.htm 文件,然后点按钮提交数据到 http://www.474150.net/ ,可以看到
动态页面的输出为:
-------------------------------------
Request.ApplicationPath=/
Request.Path=/Default.aspx
Request.UserAgent=Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Request.UserHostName=10.0.0.3
Request.UserHostAddresst=10.0.0.3
Request.UserHostAddresst=System.Web.Mobile.MobileCapabilities
Request.UrlReferrer= 直接打开动态页面,本机上执行静态页面的时候,这里是为空的。
---------------------------------
然后我又把静态页面上传到这个地址
然后在]页面上点击按钮,提交数据到 http://www.474150.net/
这时看到的动态页面的输出为:
----------------------------------------------
Request.ApplicationPath=/
Request.Path=/Default.aspx
Request.UserAgent=Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Request.UserHostName=10.0.0.3
Request.UserHostAddresst=10.0.0.3
Request.UserHostAddresst=System.Web.Mobile.MobileCapabilities
Request.UrlReferrer=http:///index.htm 这里显示请求的来源地址了。
----------------------------------------------
可以看到Request.UrlReferre属性在本机上测试和在服务器上测试时是不同的,关于 Page.Request.UrlReferrer的说明是:
获取有关客户端上次请求的 URL 的信息,该请求链接到当前的 URL。
通过以上测试可以知道通过检查的Page.Request对象的UrlReferrer属性可以判断
请求的来源的。
163也可以通过这点来实现不让外部网站提供登录邮箱接口。至于 www.hao123.com等页面上的
登录还是可以用的,估计是他做了判断了,给予了这几个特殊的网站的访问权限了。
我又试了一下在本地IIS服务器里面测试的输出
我在浏览器分别输入http://localhost/test/index.htm和输入http://127.0.0.1/test/index.htm 打开网页,然后请求动态页面,结果得到如下输出。
Request.ApplicationPath=/
Request.Path=/Default.aspx
Request.UserAgent=Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Request.UserHostName=10.0.0.3
Request.UserHostAddresst=10.0.0.3
Request.UserHostAddresst=System.Web.Mobile.MobileCapabilities
Request.UrlReferrer=http://localhost/test/index.htm
Request.ApplicationPath=/
Request.Path=/Default.aspx
Request.UserAgent=Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Request.UserHostName=10.0.0.3
Request.UserHostAddresst=10.0.0.3
Request.UserHostAddresst=System.Web.Mobile.MobileCapabilities
Request.UrlReferrer=http://127.0.0.1/test/index.htm
---------------
我又把本地iis上面的index.htm页面改用登录163.com邮箱的代码,结果
http://localhost/test/index.htm 这个提示 “对不起,您的密码不正确!” ,应该是可以正常登录的。
http://127.0.0.1/test/index.htm 这个切提示:
为了您的帐号安全,请您通过网易登录!
如果您通过其它站点登录过,请您及时修改密码。
是不能登录的。
看来 163 允许 localhost通过,但又阻止了127.0.0.1 来源的访问,其实两者都是一个东西,哈哈。163应该是通过Request.UrlReferrer属性来实现这个功能的了。
像在http://www.hao123.com上可以登录163邮箱,但你自己用一个用一个frame把http://www.hao123.com包含进来,也是登录不了的,因为这时的Request.UrlReferrer不是http://www.hao123.com了163照样认不出来(我用上面的测试程序打印的来源地址是主框架页面的地址),我在google里的翻译页面输入http://www.hao123.com让他翻译得到一个frame包含http://www.hao123.com的页面,然后试了一下是登录不了的。
[ 本帖最后由 门口蹲一狼 于 2008-12-2 22:25 编辑 ] 收到 收到通知,我的就是设的那个主页哦!:tongue/
页:
[1]