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
.NET ProgrammingC#Microsoft IIS Web Server

Avatar of undefined
Last Comment
abel
Avatar of naspinski
naspinski
Flag of United States of America image

Avatar of abel
abel
Flag of Netherlands 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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of abel
abel
Flag of Netherlands image

(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
Avatar of abel
abel
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo