?
Solved

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

Posted on 2004-03-30
3
Medium Priority
?
180 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 2000 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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

762 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