title: Web API - Post Error - {Message: 'Value cannot be null.\r\nParameter name: uriString'}
body: <p>I have a problem with my POST on ASP.NET .
  Basically the when I try to POST a new User, I get the status: &quot;400 Bad Request&quot; on Postman, but the User is being created!
  The error message is: &quot;Value cannot be null.\r\nParameter name: uriString&quot; .
  Can someone tell my why it happenes?</p>
  <p>My code is:</p>
  <p><strong>Controller:</strong></p>
  <pre><code>// POST CREATE NEW USER
          public IHttpActionResult Post([FromBody] Users User2Insert)
          {
  
              try
              {
                  int res = _usersDB.InsertUserToDb(User2Insert);
                  if (res == -1)
                  {
                      return Content(HttpStatusCode.BadRequest, $&quot;User id = {User2Insert.User_ID} was not created in the DB!!!&quot;);
                  }
                  User2Insert.User_ID = res;
                  return Created(new Uri(Url.Link(&quot;GetUserByID&quot;, new { user_id = res })), User2Insert);
              }
              catch (Exception ex)
              {
                  return BadRequest(ex.Message);
              }
          }
  </code></pre>
  <p><strong>Models (Class) :</strong></p>
  <pre><code>//INSERT USER
  public int InsertUserToDb(Users val)
  {
      //in case thers already a user with such email
      if (GetUserByEmail(val.Email) != null) return -1;
  
      string strComm =
           $&quot; INSERT INTO Users(first_name, last_name, email, pass) VALUES(&quot; +
           $&quot; N'{val.First_Name}',&quot; +
           $&quot; N'{val.Last_Name}',&quot; +
           $&quot; N'{val.Email}',&quot; +
           $&quot; N'{val.Pass}'); &quot;;
  
      strComm +=
          &quot; SELECT SCOPE_IDENTITY() AS[SCOPE_IDENTITY]; &quot;;
  
      return ExcReaderInsertUser(strComm);
  }
  
  
  
  public int ExcReaderInsertUser(string comm2Run)
  {
      int UserID = -1;
      SqlConnection con = new SqlConnection(strCon);
      SqlCommand comm = new SqlCommand(comm2Run, con);
      comm.Connection.Open();
      SqlDataReader reader = comm.ExecuteReader();
      while (reader.Read())
      {
          UserID = int.Parse(reader[&quot;SCOPE_IDENTITY&quot;].ToString());
      }
      comm.Connection.Close();
      return UserID;
  }
  </code></pre>
  <p>(I'm using SQL)</p>
  <p>Thanks for all the helpers</p>
  <p><strong>Updated (the added code of &quot;GetUserByID&quot;:</strong></p>
  <pre><code>  [Route(&quot;{id:int:min(1)}&quot;, Name = &quot;GetUserByID&quot;)]
          public IHttpActionResult Get(int user_id)
          {
              try
              {
                  Users u = _usersDB.GetUserByID(user_id);
                  if (u != null)
                  {
                      return Ok(u);
                  }
                  return Content(HttpStatusCode.NotFound, $&quot;User with id {user_id} was not found!!!&quot;);
              }
              catch (Exception ex)
              {
                  return BadRequest(ex.Message);
              }
          }
  
  
  public Users GetUserByID(int user_id)
          {
              Users u = null;
              SqlConnection con = new SqlConnection(strCon);
              SqlCommand comm = new SqlCommand(
                  $&quot; SELECT * FROM Users &quot; +
                  $&quot; WHERE user_id='{user_id}'&quot;, con);
              comm.Connection.Open();
              SqlDataReader reader = comm.ExecuteReader();
              if (reader.Read())
              {
                  u = new Users(
                      (int)reader[&quot;user_id&quot;],
                      (string)reader[&quot;first_name&quot;],
                      (string)reader[&quot;last_name&quot;],
                      (string)reader[&quot;email&quot;],
                      (string)reader[&quot;pass&quot;]
                      );
              }
              comm.Connection.Close();
              return u;
          }
  </code></pre>