Solved

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

Posted on 2004-03-30
3
174 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
error email attachment VB2010 5 27
Problem with http basic authentication 5 86
Problem to run file 9 90
Grunt No Clean Targets 6 53
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now