简体   繁体   中英

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?

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?

I am trying to show different person different homepage based on a specific associated value in sql database.

Thank you

ps I honestly dont know how the log in works. I am not a .net guy and didn't create the system. I know about URL direct for the server in default.aspx because I have been through that. 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). 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. 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.

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.

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.

Go ahead and take a look to personalization and user profiles on ASP.NET which is what you want to do.

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().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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