views:

23

answers:

1

i am using asp.net MVC and have been using mvc for quite a while now but i have something along the lines of this:

@View.greeting | <a href="/Login/Logout">LOGOUT</a>

i have to but in the logout link as if i try to pass it over the @View will html encode and show the html of the link, i would prefer to deliver a result of login or logout depending on there current status.

I know this should be simple but sometimes it is these little things that just seem to blank you out.

would appreciate a simple solution around the whole html encoding

thanks

p.s can someone create the tag for asp.net MVC 3 !!

+1  A: 

I think you're looking for this

@(new HtmlString(View.greeting))
BuildStarted
yep thats it have never seen that new HtmlString before thanks very much problem solved
minus4
Just incase you use MVC 2 at some point and run into the same problem you can use `@MvcHtmlString.Create(View.greeting)` as HtmlString doesn't exist
BuildStarted