我正在使用会话,但它不起作用 [英] I am using session but its not working
本文介绍了我正在使用会话,但它不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if (passwo == passwor)
{
Session["username"] = loginusername.Text;
Response.Redirect("profile.aspx");
}
protected void Page_Load(object sender, EventArgs e)
{
string st = Session["username"].ToString();
if (st == null)
{
Response.Redirect("login.aspx");
}
}
我尝试过:
请帮帮我我是新手编码
What I have tried:
please help me i am new to coding
推荐答案
请不要家酿你的登录 - 它效率低,容易出错,其中一些可能很严重。我怀疑从您的第一个代码片段中您已经提交了一个红衣主教罪并将您的密码存储为纯文本。这很糟糕,非常糟糕 - 请相信我。
相反,请查看简介成为会员 [ ^ ]它将其整合到您的网站中,并提供比您自己管理的更好的安全性。它也更容易使用!
Please, don't "home brew" your login - it's inefficient and prone to errors, some of which can be serious. I suspect that from your first code fragment you have already committed a Cardinal Sin and stored your passwords as plain text. That's bad, very bad - trust me on this.
Instead, look at Introduction to Membership[^] which intregrates it into your site, and provides a lot better security than you can manage on your own. It's also a lot easier to use!
这篇关于我正在使用会话,但它不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文