Solved

Scripting IIS url redirections

Posted on 2013-01-15
4
268 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
[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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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