重定向页面的问题。 [英] problem with redirecting the page.

查看:85
本文介绍了重定向页面的问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有登录页面。如果我登录然后它重定向到个人资料页面..但是我有搜索图表当我点击图表那个时候如果我不是登录用户那么我必须登录并显示相同的页面意味着搜索图表...意味着我已经重定向两个不同的页面,这取决于条件。当我在搜索图表中登录任何数据时,登录后会出现相同的数据。 PLZ帮助我?

i have login page.if i login then it redirect to profile page..but i have search chart when i click on chart that time if i am not login user then i have to login and show the same page means searching chart...means i have redirect two different pages which is depending on condition.when i login whtever data in searching chart same data comes after login. plz help me?

推荐答案

你可以使用 Session 对象,参见在其中 [ ^ ] ..



现在,在登录时间,将您的用户名/用户ID存储在一个Session对象中,如 Session [Username] = UserNameTxt.Text;

它使 Session.Count> 0 ,因此您可以在搜索图表中使用以下场景:



You can use Session object for that, see here[^]..

Now, at the log in time, store your user name/ user id in one Session object like Session["Username"] = UserNameTxt.Text;
It makes Session.Count > 0, so you can use following scenario at Searching Chart:

if(Session.Count > 0)
{
    Response.Redirect("home.aspx");
}
else
{
    Response.Redirect("login.aspx");
}





希望它能解决你的问题.. :)如果有什么你不会得到的这个,让我知道...... :) :)



Hope it will solve your issue.. :) If there is something that you don''t get about this, let me know... :) :)


这篇关于重定向页面的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆