I'm using Visual Studio 2012 and playing around with Windows Phone 7.1 application development. This is a newly-created project.
When I use this code, why do I get this error?
The name 'WebRequestMethods' does not exist in the current context
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
...
public MainPage() {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
request.Method = WebRequestMethods.Http.Post;
}
...
It seems like it can't recognise that WebRequestMethods is a part of System.Net. It also fails if I specify System.Net.WebRequestMethods.Http.Post.