我如何比较数据库中的值和asp.net中我们页面的textbox或url中的值。 [英] how i can compare the value from database and the value from textbox or url of our page in asp.net.

查看:61
本文介绍了我如何比较数据库中的值和asp.net中我们页面的textbox或url中的值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何比较数据库中的值和asp.net中我们页面的网址中的值。



i必须创建注册表单,然后我发送特权注册人的信息,并发送链接和该链接有一些ID通过该ID和数据库中的ID相同,然后该用户启用stste ...



并禁止使用该账户

因此,如果他们启用了,那么他们在该链接上进一步陈词滥调或使用我在链接中提供的那个页面.... pls发送给我...

how i can compare the value from database and the value from the url of our page in asp.net.

i have to create registration form and then i send the messge to the particuler regstered person and also send the link and that link have some id passed that id and the id of in database is same then that user were enable stste...

and either disable to use that acount
so if they are enable so,further they are cliclk on that link and acessing or use that page which i have provided in link....pls send me ans...

推荐答案

你可以获得用户名&您作为查询字符串发送给用户的密码。阅读查询字符串&将这些值与数据库值进行比较。如果值'匹配则用户是有效用户&然后你可以启用这个用户。



所以如果你有类似用户确认页面的东西(这是你要发送给用户的链接.. htt:/ /localhost/UserConfirmation.aspx?UserName=\"Test\"&Password=\"1234\"),on Page_Load你可以检查值,



string userName = Request.QueryString [UserName];

string password = Request.QueryString [Password];




//添加逻辑以从数据库获取数据// - >您可以发送此用户名&密码到数据库&如果是有效用户,请检查是否有任何用户在场。



即从UserTable中选择userName,其中username = userName和password = password



如果此查询给出一个结果记录,那么用户有效就可以启用该用户。





请注意: - 它建议当你在查询字符串中发送数据时尝试加密它。
You can get User Name & Password which you hae sent to user as query string. Read the query string & compare those values with data base values. If value''s are matching then user is valid user & then you can enable this user.

So if you are having something like user confirmation page(This is the link you are going to send to user.. htt://localhost/UserConfirmation.aspx?UserName="Test"&Password="1234"),on Page_Load you can check the values,

string userName = Request.QueryString["UserName"];
string password = Request.QueryString["Password"];


// add logic to get data from database // -> You can send this username & password to database & check if there is any user present if yes its valid user.

i.e. select userName from UserTable where username = userName and password = password

If this query gives one result record then user is valid you can enable that user.


Please Note :- Its advised that when you send data in querystring try to encrypt it.


这篇关于我如何比较数据库中的值和asp.net中我们页面的textbox或url中的值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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