Solved

Append http://www to a URL

Posted on 2016-08-03
4
72 Views
Last Modified: 2016-08-04
I would like to append http://www. either through code or in IIS. What is the best way of going about this ?

Thanks,
Aditya
0
Comment
Question by:giveindia
[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
4 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 41740614
I'm guessing you mean prepend, not append; and the answer depends a lot on what it is you're trying to do.  The most basic answer would be something like...

Dim strNewURL as String = ""
strNewURL = "http://www." & strOldURL

...but it's hard to say without more information.
0
 
LVL 35

Expert Comment

by:YZlat
ID: 41740913
Try checking whether the string starts with "http://www." first:

If Not strURL.StartsWith("http://www.", StringComparison.InvariantCulture) Then
	strURL = "http://www." & strURL

End if

Open in new window

0
 
LVL 28

Accepted Solution

by:
Dan McFadden earned 500 total points
ID: 41741031
I recommend using IIS URL Rewrite model.

Here's an article to explain how to do it.

Link:  http://weblogs.asp.net/owscott/iis-url-rewrite-rewriting-non-www-to-www

Dan
0
 

Author Closing Comment

by:giveindia
ID: 41741931
That worked.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

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…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

732 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