zsharp
zsharp

Reputation: 13756

Displaying user website link in view

Is this fine or is there a different way?

 <a href="Http://<%=Html.Encode(Model.Website)%>"><%=Html.Encode(Model.Website??"")%></a>

Upvotes: 0

Views: 63

Answers (2)

RichardOD
RichardOD

Reputation: 29157

You could write a custom HTML Helper to do it for you.

Upvotes: 1

Eric Petroelje
Eric Petroelje

Reputation: 60498

Seems fine to me, although you might want to check that the website doesn't already start with "http://" as well.

Upvotes: 2

Related Questions