0

I am having a problem with a transition in a view change in my Asp.NET MVC5 project.

I get an exception with the following message:

'System.NullReferenceException' occurred in App_Web_createticket.cshtml.be8191cf._cxorvd0.dll but was not handled in user code

This error only occurs when I try to switch from one view to another by using form submit. I do not get the error when I just input the URL straight into the address bar in the browser.

The controller that switches to the other view :

[HttpPost]
public ActionResult UserToAdd()
{
    SecruityService secruityService = new SecruityService();
    ChangeRequestor userToAdd = new ChangeRequestor();
    userToAdd.RequestorId = Request.Form["User"];
    userToAdd.RequestorName = Request.Form["Name"];
    userToAdd.RequestorPhone = Request.Form["Phone"];
    userToAdd.RequestorEmail = Request.Form["Email"];
    secruityService.AddUser(userToAdd);
    return View("~/Views/TicketCreator/CreateTicket.cshtml");
}

The CSHTML code:

<form name="AddUser" action="@Url.Action("UserToAdd", "AddUser")" method="post" >
        SSO Username: <input type="text" id="User" name="User"  />
        Full Name: <input type="text" id="Name" name="Name"  />
        Phone Number: <input type="text" id="Phone" name="Phone"  />
        Email: <input type="text" id="Email" name="Email"  />
        <input id="Submit" name="Submit" type="submit" value="Add User" >

Also the error occurs on the last ajax call that I call in the view. It does not matter which call I put as last that is where the error occurs.

Image of error:This is the error that pops up

David Tansey
  • 5,813
  • 4
  • 35
  • 51

0 Answers0