Chcę zrobić aplikację na lumię z systemem windows phone. Aplikacja realizowała napisana w vb, która realizowała by zapytanie http. Najpierw zrobiłem taką aplikację jako aplikację windowsową. Realizuje to co chciałem. Teraz chcę to samo zrobić na phone i pojawia się problem.
Dim postData As String = "out1name=BEZ_NAZWY&outpwr1sta=WLACZONY&out1sta=WLACZONY&o1act=res&toff1=1"
Dim tempCookie As New CookieContainer
Dim encoiding As New UTF8Encoding
Dim byteData As Byte() = encoiding.GetBytes(postData)
Dim postreq As HttpWebRequest = DirectCast(WebRequest.Create("http://admin:@192.168.2.222/outputs:80"), HttpWebRequest)
postreq.Method = "POST"
postreq.KeepAlive = True
postreq.CookieContainer = tempCookie
postreq.ContentType = "application/x-www-form-urlencoded"
postreq.Referer = "http://admin:@192.168.2.222/outputs"
postreq.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36"
postreq.ContentLength = byteData.Length
Dim polaczenie As New NetworkCredential
polaczenie.UserName = "admin"
postreq.Credentials = polaczenie
Dim postreqstream As Stream = postreq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
postresponse = DirectCast(postreq.GetResponse(), HttpWebResponse)
tempCookie.Add(postresponse.Cookies)
logincookie = tempCookie
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
Błędy pojawiają się w wierszach:
Dim postreqstream As Stream = postreq.GetRequestStream()
'GetRequestStream' is not a member of 'System.Net.HttpWebRequest'.
postresponse = DirectCast(postreq.GetResponse(), HttpWebResponse)
'GetResponse' is not a member of 'System.Net.HttpWebRequest'.
tempCookie.Add(postresponse.Cookies)
Overload resolution failed because no accessible 'Add' accepts this number of arguments.
Wie ktoś w czym jest problem?