title: "The requested resource does not support http method 'POST'
body: <p>i M doing  post request from angular 2 with asp.net webapi 2 
  when i m running my app. it giving me above error message
  i checked its response in fiddler as </p>
  
  <p>&lt;<a href="https://i.stack.imgur.com/vbiC5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vbiC5.png" alt="enter image description here"></a>></p>
  
  <p>i search on google for the solution and made changes according to suggestion but still i m facing the same error.
  <strong>Asp.net web api code is:-</strong></p>
  
  <pre><code>public void postvalidUser(string UserName,string Password)
      {
          try
          {
              var login = uData.Users.Where(x =&gt; x.UserName == UserName).ToList();
              if (login != null &amp;&amp; login.Count &gt; 0)
              {
                  foreach (var log in login)
                  {
                      if (log.UserName == UserName &amp;&amp; log.Password == Password)
                      {
                          Console.WriteLine("login ok");
  
                      }
  
                  }
              }
              else
              {
                 Console.WriteLine("login fail");
  
              }
  
          }
  
          catch (Exception ex){
  
              Console.WriteLine(ex);
          }
  
      } 
  </code></pre>
  
  <p><strong>login.servuce.ts code</strong></p>
  
  <pre><code>@Injectable()
  export class LoginService {
  
    constructor(private _http: Http) { }
    postvalidUser(UserName: string, Password: string) {
      const users = { UserName: UserName, Password: Password };
      let body = JSON.stringify(users);
      let headers = new Headers({ 'Content-Type': 'application/json' });
      let options = new RequestOptions({headers: headers });
  
      return this._http
        .post("http://localhost:65440/api/User", users, options)
        .map(result =&gt; result.json());
    }
  
    }
  </code></pre>
  
  <p><strong>login.component.ts</strong></p>
  
  <pre><code>export class LoginComponent implements OnInit {
  
    constructor(private _loginservices: LoginService) {  }
  
    ngOnInit() {
    }
    OnClick(UserName: string, Password:string) {
      this._loginservices.postvalidUser(UserName, Password)
           .subscribe(users =&gt; console.log(users));
  
    }
  </code></pre>
  
  <p><strong>login.component.html</strong></p>
  
  <pre><code>  &lt;div&gt;
    &lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;UserName&lt;/td&gt;&lt;td&gt;&lt;input [(ngModel)]="UserName" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;Password&lt;/td&gt;&lt;td&gt;&lt;input [(ngModel)]="Password" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;button class="btn btn-primary" (click)="OnClick(UserName.value,Password.value)"&gt;Submit&lt;/button&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Please correct me if i have some error in my code </p>