Forum Moderators: open

Message Too Old, No Replies

Finding Items in a URL

         

traeanthony

4:03 am on May 7, 2006 (gmt 0)

10+ Year Member



First of all, sorry for the description, it was the only thing I could think of.

I have a site that has an asp form on it. The thing is, people can enter in a url that the form uses later in the process. The "http://" is added on automatically in the form. So the user can only add in the "www.site.com" part of the url. However, if there's a really long url and they copy it into the URL field in the form, they sometimes forget to remove the "http://" and then get an asp error. I thought about creating an error for this so the user can understand what is going on, but thought that wouldn't be the professional way to handle it. Which leads me to my question:

Is there anyway to see if a user has inputted the "http://" in to the field, and if so, delete it, or if they haven't entered it, add it to the url?

Any help would be much appreciated. Thanks in advance!

-Trae

carguy84

7:51 am on May 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if left(lcase(strURL), 4) <> "http" then
strURL = "http://" & strURL
end if

The reason I only check the first 4 is because the user could enter in https and that would screw it all up.

Chip-

traeanthony

4:54 am on May 8, 2006 (gmt 0)

10+ Year Member



Worked Great! Thank you for your help. I never would have thought about the https thing either.