Solved

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

Posted on 2004-03-30
3
177 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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Auto Complete Using JQuery 5 87
How to setup a password to enter my web page? 3 117
Format results with PHP 3 79
Problem to page 4 93
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
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.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

856 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