Q:

ViewContext does not exist in current context

I have a MVC project. In views,I'm using ViewContext to load values from resource file like this. 
@ViewContext.HttpContext.GetGlobalResourceObject("XyzResources", "MonLabel")

I'm getting an error- 
The name ViewContext does not exit in current context
Following are the namespace which I have added in the page. 
@using System.Configuration
@using System.Globalization
@using System.Web.Configuration
@using Telerik.Sitefinity.Utilities.Lucene.Net.Documents
@using Telerik.Sitefinity.UI.MVC

I don't know why it's giving me that error. If I run the project with error, it displays the page with out any issues. I also get the values from resource file. 
But I don't know how to resolve it.
Thank you. 

A:

You don't need to use ViewContext. In your views you can just access resources like that:
@System.Web.HttpContext.GetGlobalResourceObject("XyzResources", "MonLabel")

Or you can use like that:
@HttpContext.GetGlobalResourceObject("XyzResources", "MonLabel")

But Sitefinity has better way to handle localization with resources. 
In Sitefintiy backend you can already manage resource labels. (In Administration->Labels & Messages)
Then, in views you can access it like that:
@Html.Resource("AmazonSearchServiceTitle", "ProductsResources")

You can find more information about resources in Sitefinity in this article: http://docs.sitefinity.com/for-developers-create-custom-resource-classes

