[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how do i redirect using cgi on a windows server?  easy question, lots of points!

Posted on 2004-09-29
7
Medium Priority
?
255 Views
Last Modified: 2013-12-25
I am programming on a windows server.

We have to field a request to http://www.mydomain.com/car.cgi?make=honda&year=1999

I just want to redirect the request with parameters to a .aspx page:
http://www.mydomain.com/car.aspx?make=honda&year=1999

What code could I put into car.cgi to redirect to car.aspx?
0
Comment
Question by:wilbur88
[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
  • 2
  • 2
7 Comments
 
LVL 15

Expert Comment

by:periwinkle
ID: 12185355

I think it would be something like:

use CGI qw(:standard);
my $passparms=$ENV{'PATH_INFO'};
print(redirect(qq(http://www.mydomain.com/car.aspx$passparams)));
0
 

Author Comment

by:wilbur88
ID: 12185681
I tried it and I just get on my page:

Status: 302 Moved Location: http://www.mydomain.com/car.aspx 
0
 

Author Comment

by:wilbur88
ID: 12186656
I have tried many other approaches too, from browsing through past solutions on experts exchange.  They all just print in the browser's window the url that I'm trying to go to!
Some of the other approaches I've tried:

print("Location:www.experts-exchange.com");

$query = new CGI;
print $query->redirect('http://www.mydomain.com/car.aspx' );

print "Content-type: text/html\n";
$location"http://www.mydomain.com/car.aspx";
print "Location: $location\n\n";

It doesn't seem like I'm even close!
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
LVL 5

Accepted Solution

by:
ITcrow earned 2000 total points
ID: 12187093

Just put the following print statement in your CGI ( perl script ) and you will be fine:
Eg.
=======================================================
print qq~
<script>
window.location.replace("http://www.mydomain.com/car.aspx");
</script>
~;
=======================================================

And if you want to pass with arguments, you could use $ENV{'QUERY_STRING'}
Eg.
=======================================================
print qq~
<script>
window.location.replace("http://www.mydomain.com/car.aspx?$ENV{'QUERY_STRING'}");
</script>
~;
=======================================================
0
 

Author Comment

by:wilbur88
ID: 12189753
Yes, ITCrow!  and the 2nd part worked great for parameters as well.  Thanks so much-  Have a wonderful day-
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12189857
D'oh - clearly the cold medicine is affected my brain - thanks ITCrow - it would decidedly be QUERY_STRING, not PATH_INFO - lol.
0
 
LVL 5

Expert Comment

by:ITcrow
ID: 12192045
You are welcome wilbur88.

periwinkle,
while you were at cold_medicine_r_us, I jacked up my caffeine intake.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

649 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