S
shapper
Hello,
I am working with ASP.NET MVC and I have the following:
public static class ApplicationService {
public static Sitemap GetSitemap() {
string url = UniformResourceIdentifierHelper.ToAbsoluteUrl
((HttpContextWrapper)base.HttpContext, "/Home/Index").ToString();
Sitemap map = new Sitemap();
map.Add(url);
return map;
}
}
I keep having the same error on "base": Keyword 'base' is not
available in a static method
I am calling GetSitemap from a method in my ASP.NET MVC controller:
public ActionResult Sitemap() {
Sitemap sitemap = ApplicationService.GetSitemap();
...
}
The error disappears if I move all the code from GetSitemap method to
my controller
public ActionResult Sitemap() {
string url = UniformResourceIdentifierHelper.ToAbsoluteUrl
((HttpContextWrapper)base.HttpContext, "/Home/Index").ToString();
Sitemap map = new Sitemap();
map.Add(url);
...
}
I just would like to have the Sitemap creation on a service instead of
having it on the controller.
Thanks,
Miguel
I am working with ASP.NET MVC and I have the following:
public static class ApplicationService {
public static Sitemap GetSitemap() {
string url = UniformResourceIdentifierHelper.ToAbsoluteUrl
((HttpContextWrapper)base.HttpContext, "/Home/Index").ToString();
Sitemap map = new Sitemap();
map.Add(url);
return map;
}
}
I keep having the same error on "base": Keyword 'base' is not
available in a static method
I am calling GetSitemap from a method in my ASP.NET MVC controller:
public ActionResult Sitemap() {
Sitemap sitemap = ApplicationService.GetSitemap();
...
}
The error disappears if I move all the code from GetSitemap method to
my controller
public ActionResult Sitemap() {
string url = UniformResourceIdentifierHelper.ToAbsoluteUrl
((HttpContextWrapper)base.HttpContext, "/Home/Index").ToString();
Sitemap map = new Sitemap();
map.Add(url);
...
}
I just would like to have the Sitemap creation on a service instead of
having it on the controller.
Thanks,
Miguel