Solved

Scripting IIS url redirections

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 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

20 Experts available now in Live!

Get 1:1 Help Now