Solved

Modifiying a redirect URL by pulling a field from MSSQL database.

Posted on 2004-03-30
3
179 Views
Last Modified: 2010-04-06

I have a "proactive" login page , we'll call it:     http://www.website.com/proactiveLogin.asp 
I have a MSSQL database that has a table , we'll call it:  portal_users that contains two columns  : username and dynamic_url


The user navigates to the proactiveLogin form and enters his username
and password. If authenticated, A header value is assigned  called HTTP_AUTH_HTTP_USER, which is the username found in the database, and then the user is redirected to https://www.website.com/controller.asp.  

This is where i'm stuck.  I have an IIS server and I desperately need an ASP script that will use the HTTP_CAMS_HTTP_USER
request header value to identify the user, thus the username in the database and redirect the user to the link found in the dynamic_url column for that username.

Sounds simple enougn but I have no Idea how to acomplish this.  Help!



0
Comment
Question by:Maclain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Expert Comment

by:third
ID: 10720405
where are you in now? probably if you can post some of your code, it will be easy for us to do the part that you don't know.

basically, should just be

response.redirect rs("dynamic_url")
0
 

Author Comment

by:Maclain
ID: 10720478
Hi Third.

This is what the developer provided for me.  I need the code for the query/logic to create the URL.



1) Get the Cams user, something like (we use JScript in our ASPs but
there will be equivalent for VB, etc):

<%@ language = JScript %>

<%
   var username = Request.ServerVariables("HTTP_CAMS_HTTP_USER");
%>

2) Do the query/logic to create the URL. I'll need to put the dynamic URL into a variable named "dynamicUrl".  


3) Finally, do the redirect (this is the "controller" logic), something
like:

<%
   // Redirect to dynamic URL only if it exists.
   if (new String(dynamicUrl).length > 10)
     Response.Redirect(dynamicUrl);
   else
     Response.Redirect(
        "http://www.website.com/dyanmicUrlError.asp?dynamicUrl=
         <%= dynamicUrl %>");
%>

0
 
LVL 1

Accepted Solution

by:
galathea00 earned 500 total points
ID: 10721596
The dynamic_URL is a field name in your table in the database? Did I get this right?

If so then you have to connect to that database and query the username and retrieve the
value of the dynamic_url field.

Use ADOdb.connection and ADOdb.recordset

then create a query="Select * from portal_users where username ='" & username  & "'"

then save the value of your field to the dynamicurl variable ... dynamicURL =  rs.fields("dynamic_url").value

and redirect.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question