I'm creating a MVC 4 application, I had error like following.
I tried lot of things but I can't find what is the problem.here is my Controller source
public ActionResult Index(string EventId)
{
HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["User"];
if (cookie != null)
{
string Type = (cookie["Type"] == null || cookie["Type"] == "") ? null : cookie["Type"].ToString();
string Username = (cookie["Username"] == null || cookie["Username"] == "") ? null : cookie["Username"].ToString();
ViewBag.Message = Type;
ViewBag.Username = Username;
try
{
string ReplaceEventID = EventId.Replace('-', '/');
ViewBag.Message = ReplaceEventID;
IEnumerable<Job> JobListRelatedToEvent = DBContext.Jobs.Where(x => x.EventId == ReplaceEventID);
return View(JobListRelatedToEvent);
}
catch
{
return View();
}
}
else
{
return RedirectToAction("Index", "Home");
}
}
UPDATE: When it run on my local machine it works fine, but after i published to the server I got this error.
Can anyone tell about what's the wrong?
I am facing the same issue and this issue we are getting if the custom error is on.
What you need to do the changes in web.config and add the below code. So, you will get the actual error of the application or in code level.
<system.web>
<customErrors mode="Off" />
Now insted of generic page of IIS it will shows the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With