0

This is probably a very simple solution of code syntax of Sql or maybe.
I have a Text Box. id=textbox1
I insert a URL in there. eg: www.google.com
my code in SQL

cmd.CommandText = "insert into Link(URL) values (@URL)";
cmd.Parameters.AddWithValue("@URL", textbox1.Text);

Now on the client side, I have this code to go to the URL

 <a href="<%# Eval("URL") %>" target="_blank">Click here</a>

My problem is , when I click on the link, instead of going directly to www.google.com
the links adds in the url of the original domain too.
eg: www.mydomainname.com/www.google.com

any assistance please?

Lemdor
  • 150
  • 3
  • 15

1 Answers1

2

It looks like your're missing the protocol for the URL. I imagine it would work if you enter http://www.google.com.

By design href-targets are not limited to the http protocol, but can also contain other things like mailto, file, ...

See html - links without http protocol for some more information.

philipproplesch
  • 2,127
  • 17
  • 20