Solved

Scripting IIS url redirections

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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