Link to home
Start Free TrialLog in
Avatar of DFIM
DFIM

asked on

Can't end url with response.write using C#

I am familiar with vbscript however converting to C# and trying to end a URL I have written with response.write. My code is below:

Response.Write("<a href= " + savePath + "</a>");

The URL works fine however everything on the page is linked to the URL. When I hover over the URL it has '/a' at the end ignoring the '>'.

Thanks for your help
Avatar of naspinski
naspinski
Flag of United States of America image

It is often better to try to refrain from Response.Write, but if you have to do it that way, do not forget that you ahve to provide the full and correct HTML for it, including quotes and text:

Response.Write("" + "this is my link" + "");

you can replace "this is my link" with savePath or any text you want to appear as the link.

If you use C# you probably also use ASP.NET where you should use a runat="server" link with an ID and you can then set that object's href and text from the code behind. That way, the syntax will automatically be correct.
ASKER CERTIFIED SOLUTION
Avatar of naspinski
naspinski
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
(retry, the RTE #$%^&* it up...)


Response.Write("" + "this is my link" + "");

you can replace "this is my link" with savePath or any text you want to appear as the link.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial