Solved

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

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
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…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

831 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