.net web项目,首页ajax请求session为空,其他页面可以获取到,急。。。。。。
JS代码:、、、、
var str="http://"+location.hostname+"/";
var params = str+ '/brandlist.aspx?Option=GetLoginInfo&t=' + new Date();
alert(params)
jQuery.ajax({
type: "get",
url: params,
dataType :'text',
success: function(msg){
var str = msg.split('|');
document.getElementById('head_reg').href = str[1];
document.getElementById('head_login').href = str[2];
if (str[0] == '') {
document.getElementById('head_reg').innerText = '[免费注册]';
document.getElementById('head_login').innerText = '[请登录]';
} else {
document.getElementById('head_reg').innerText = '['+str[0]+']';
document.getElementById('head_login').innerText = '[退出]';
}
try {
document.getElementById('head_cartItemCount').innerText = str[3];
} catch (e) {}
}
});
C#代码。。。。。
public partial class brandlist : System.Web.UI.Page, IHttpHandler, IRequiresSessionState
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string strOption = eShop.WebPage.PageRequest.GetQueryString("Option");
if (strOption == "GetLoginInfo")
{
eShop.Web.ProfileCommon profile = new eShop.Web.ProfileCommon();
&nbs