Solved

Append http://www to a URL

Posted on 2016-08-03
4
58 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
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 26

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
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…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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