Reputation: 427
Here :
public baseController()
{
string surl = Request.Url.AbsoluteUri;
}
This is not accessible : "Object reference not set to an instance of an object."
This one is OK :
public ActionResult index()
{
string url = Request.Url.AbsoluteUri;
}
I believe current http context is only accessible on actionrendering ? Ayway, I need to get this URL thing before actually calling an actionresult, I'm I missing something ?
Upvotes: 1
Views: 1166
Reputation: 1172
You can acces the url property by calling the current context directly
System.Web.HttpContext.Current.Request.Url
Upvotes: 2