Solved

Scripting IIS url redirections

Posted on 2013-01-15
4
262 Views
Last Modified: 2013-01-20
I am trying to figure out how to write a script that redirects URLs without using ?u=
Eg. From:
http://mydomain.com/smallstring
to
http://otherdomain.com/some/longer/more/complicatedstring.asp?test=1234

I know I can create an ASP.net page that redirects using the ?var=value
eg: http://mydomain.com/?t=smallstring

However, I'm trying to find out how I can do it without the ?t=
eg: http://mydomain.com/smallstring
0
Comment
Question by:DFPITC
  • 3
4 Comments
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 38781007
Some pseudo code..
If instr(URLString,"/t?=") Then
Replace (URLString,"/t?=", "/")
End If

Open in new window


Otherwise, you could do it in an .htaccess file..

HTH,

Kent
0
 

Author Comment

by:DFPITC
ID: 38781260
I'll rephrase the issue, as there seems to be some confusion here..

We need to send out many adverts in the newspaper to visit different URLs.

The URLs are quite long and complex, so we need a URL shortener.

We want to provide our own service, similar to tinyurl.com

I can manually create redirections in IIS to go from
http://mydomain.com/something -> http://otherdomain.com/complex/url.aspx?t=something

I want to be able to script this.

I know how to make a single asp page, that accepts a parameter, looks up the URL using that parameter from an SQL database and redirects the user, in the following format:
http://mydomain.com/?var=uniquestring

What I don't know how to do is remove the "?var=" so it looks neat in advertisements.

I ultimately want the URL being advertised in the newspaper to be something like:
http://mydomain.com/uniquestring
0
 

Accepted Solution

by:
DFPITC earned 0 total points
ID: 38781414
ok, so the answer is:

get: http://www.iis.net/downloads/microsoft/url-rewrite

and use it to re-write
http://mydomain.com/somestring
to
http://mydomain.com/redir.aspx?var=somestring
and use that to lookup somestring in SQL and redirect the user to the external complex URL
http://otherdomain.com/some/complex/url.aspx?arguments=stuff
0
 

Author Closing Comment

by:DFPITC
ID: 38798128
I found the answer with more research.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

12 Experts available now in Live!

Get 1:1 Help Now