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
Solved

Scripting IIS url redirections

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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