csdn登录问题
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="loginn.aspx.cs" Inherits="Maticsoft.Web.loginn" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="CSS/StyleSheet1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/JS/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/JS/csdn.js?v=1.1"></script>
</head>
<body>
<script src="http://csdnimg.cn/pubnav/js/pub_topnav_2011.js"type="text/javascript"></script>
<div class="full">
<div class="logo_login02">
<img src="/IMG/logo_login01.gif" />
</div>
<div class="content_login">
<div class="top_bg"></div>
<div style="padding:40px;">
<div class="left_login">
<iframe id="logfrm" src="WebForm2.aspx?callback=logined&hidethird=1&from=http%3a%2f%2fforum.csdn.net%2fSList%2fASPDotNET%2f" style="width:420px;height:380px;" frameborder="0" scrolling="no"></iframe>
</div>
<div class="center_login"></div>
<div class="right_login">
<p><img src="/IMG/pic_text.gif" alt="" /></p>
<p class="button"><a class="btn_loginr" href="/account/register"><span>立即注册</span></a></p>
</div>
<div class="clear"></div>
<table id="tb_third" cellpadding="4" cellspacing="8">
<tr>
<td width="70"><b style="font-size:12px; color:#777;">第三方登录</b></td>
<td id="td_third">
<a href="/auth/sinat"><img src="/images/button/third_sinat.png" /></a>
<a href="/auth/qq"><img src="/images/button/third_qq.png" /></a>
<a href="/auth/google"><img src="/images/button/third_google.png" /></a>
<a href="/auth/aliyun"><img src="/images/button/third_aliyun.png" /></a>
</td>
</tr>
</table>
</div>
<div class="btm_bg"></div>
</div>
<script type="text/javascript">
var f = decodeURIComponent('http%3a%2f%2fforum.csdn.net%2fSList%2fASPDotNET%2f');
alert(f);
</script>
<script type="text/javascript">
if (f.indexOf("about:") > -1 || f.indexOf("javascript:") > -1)
f = "http://localhost:2087/";
var plow = false;
function logined(data) {
if (data.status) {
if (plow) {
location = "/account/pwdnote?from=" + escape(f);
alert(location);
}
else location = f;
} else {
if (data.error.indexOf("激活") > -1) {
location = "/account/active";
} else {
alert(data.error);
}
}
}
$(function () {
if (f != 'http://localhost:2087/') {
$('#td_third a').attr('href', function () {
return this.href += '?from=' + encodeURIComponent(f);
});
}
});
</script>
<div style="text-align: center;">
<script type="text/javascript" src="http://csdnimg.cn/pubfooter/js/publib_footernew.js"></script>
</div>
</div>
<script type="text/javascript" src="/JS/csdn.loading.js"></script>
<script type="text/javascript">
document.write("<img src=http://counter.csdn.net/pv.aspx?id=20 border=0 width=0 height=0>");
</script>
</body>
</html>
这是csdn登录页面,我想知道上面iframe的src值的from参数是如何实现的?
var f = decodeURIComponent('http%3a%2f%2fforum.csdn.net%2fSList%2fASPDotNET%2f');
这句中url地址也是随登录前一页面地址变化的,请帮忙是如何实现的?
[解决办法]
urldecode
[解决办法]
是这样子实现的,你首先在其他页面吧? 点击登录的时候,在点击事件里面,把当前页面的地址比如说www.csdn.net 使用HttpUtility.UrlEncode编码,然后使用Response.Redirect跳转到登录页比如说www.baidu.com,然后呢,把之前那个编码的字符串作为url参数传过去,意思是跳转到这个链接,www.baidu.com/?l=www.csdn.net,这个www.csdn.net是你编码的字符串,然后在登录页面登录成功之后,取出这个值,然后HttpUtility.Decode解码,跳转到这个页面,就实现了这个功能