0

I am new to web development. I have a simple question

I have the following server side code

linkButton.PostBackUrl = "PageRedirect.aspx?Link=" + values[1];

When I click on the link, it takes me to the root website passing values[1] to it

http://localhost:3783/MyWebsite/www.facebook.com

which actually doesn't exist

note that PageRedirect.aspx exists directly under the original root as well as the page from which the code is executed.

mustafabar
  • 2,317
  • 6
  • 31
  • 47

2 Answers2

1

Does changing it to this work?

linkButton.PostBackUrl = "~/PageRedirect.aspx?Link=" + values[1];
JamieGaines
  • 2,062
  • 1
  • 18
  • 20
1

It turns out that all values[1] (the link) should start with http:// otherwise it will not recognize it

mustafabar
  • 2,317
  • 6
  • 31
  • 47