简体   繁体   English

可以在default.aspx Web应用程序中使用sql查询

[英]Can one use sql query in default.aspx web application

Can I use sql query and alter server url based on the sql query result? 我可以根据sql查询结果使用sql查询和alter server url吗?

If sql query gives value of 1, point the server to home.aspx and if the sql query gives value of 0, point to home2.aspx? 如果sql查询的值为1,则将服务器指向home.aspx,如果sql查询的值为0,则指向home2.aspx?

I am trying to show different person different homepage based on a specific associated value in sql database. 我试图根据sql数据库中的特定关联值显示不同的人不同的主页。

Thank you 谢谢

ps I honestly dont know how the log in works. ps老实说,我不知道登录是如何工作的。 I am not a .net guy and didn't create the system. 我不是.net的人,也没有创建系统。 I know about URL direct for the server in default.aspx because I have been through that. 我知道default.aspx中服务器的URL直接,因为我已经完成了。 there is singlesignon settings applied on the website so when a user logs into the lets say web A, he/she can click on a hyperlink, it will pass the encrypted user login info and the user will automatically be on the home page of website b (log in page for website B is skipped). 在网站上应用了singlesignon设置,因此当用户登录时可以说Web A,他/她可以点击超链接,它会传递加密的用户登录信息,用户将自动进入网站b的主页(跳过网站B的登录页面)。 I will update my acceptance rate. 我会更新我的录取率。

Thank you 谢谢

ps 2: I am just trying to pull the INCOMING user's active flag from a column in a table in a sql db. ps 2:我只是试图从sql db中的表中的列中提取INCOMING用户的活动标志。 If the flag for that particular user is set to 1, point them to URL A, if flag is set to 0, point them to URL B. 如果该特定用户的标志设置为1,则将它们指向URL A,如果flag设置为0,则将它们指向URL B.

Thank you 谢谢

You can redirect doing that but you should not ! 你可以重定向这样做,但你不应该 Why? 为什么? Well, calling the DB every time a visitor comes will make your response time way long to wait. 好吧,每次访问者都会调用数据库,这会使您的响应时间长得等待。 What you can do is cache the result on memory or at least disk (using a B+ tree for example) or better to provide a common homepage and then redirect. 你可以做的是将结果缓存在内存或至少磁盘上(例如使用B +树)或更好地提供一个公共主页,然后重定向。

Now, once you identify a user set say a cookie for the redirection and for so on use the cookie (don't forget it to authorize if needed), that'll speed up things. 现在,一旦你确定一个用户集为重定向说一个cookie然后使用cookie(不要忘记它在需要时进行授权),这将加快速度。

Go ahead and take a look to personalization and user profiles on ASP.NET which is what you want to do. 继续看一下ASP.NET上的个性化和用户配置文件 ,这是您想要做的。

Randolf's comments are true. 兰道夫的评论是真实的。 But in order to do what you want, if you for some reason still want to do this, you'll want to look at Server.Transfer() (more efficient, and preferable if you are redirecting to another page that's on the same server, within the same app), or Response.Redirect(). 但是为了做你想做的事情,如果你出于某种原因仍然想要这样做,你会想看看Server.Transfer()(更高效,如果你重定向到同一台服务器上的另一个页面,那就更好了) ,在同一个应用程序内),或Response.Redirect()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM