在ASP.NET中使用SQL Server创建会话变量 [英] create session variable using sql server in asp.net

查看:97
本文介绍了在ASP.NET中使用SQL Server创建会话变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好... !!

我是asp.net的新手,让我知道使用过sql server 2005,并检查了用户名和密码,现在如何创建会话变量,用户希望将frm login.aspx登录到他的配置文件. aspx..now,如果用户单击注销链接,则应将其重定向到default.aspx,然后在浏览器中单击,然后应要求重新登录agian. globle.aspx login.aspx的代码和注销链接的代码..如果可能,请为我提供相同的确切链接或示例.

Hello everyone...!!

I m totally new to asp.net let me knw that i have used sql server 2005,and made it checked for userid and password,now how to create session variable,user want to login frm login.aspx to his profile which is profile.aspx..now if user clicks on logout link he should be redirected to default.aspx,and then he clicks on back in browser then should be asked for relogin agian..i knw it become happen by session only,but how?provide me code for globle.aspx login.aspx and logout link code..if possible provide me the exact link or example for the same.

推荐答案

创建会话变量的方法如下这样做很简单:

Creating a session variable is as simple as doing this:

Session("variableName") = "somevalue";
Session("anotherVar")   = 0;



只要记住变量名是区分大小写的,所以"variableName"和"variableNAME"是不同的.另外,在检索值时必须将其转换为适当的类型.



Just remember that variable names are case sensitive, so "variableName" is NOT the same as "variableNAME". Also, you have to cast the value to the appropriate type when you retrieve it.


您始终可以尝试从头开始阅读简单的
You could always try starting at the beginning and reading the simple How to: Implement Simple Forms Authentication[^]

It''s amazing what you can find if you practice a little google-fu.


您可以参考以下链接来完成工作:

http://www.dotnetfunda.com/articles/article114.aspx [ http://www.dotnetfunda.com/articles/article141.aspx [ http://www.asp.net/security/tutorials/an-overview- of-forms-authentication-vb [ ^ ]

希望这会有所帮助:)
You can refer to the following links to get your job done:

http://www.dotnetfunda.com/articles/article114.aspx[^]

http://www.dotnetfunda.com/articles/article141.aspx[^]

http://www.asp.net/security/tutorials/an-overview-of-forms-authentication-vb[^]

hope this helps :)


这篇关于在ASP.NET中使用SQL Server创建会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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