こんばんは、こちらで初質問をさせて頂くものです。
現在アニメ化などで有名になっている「艦これ」というゲームの専用ブラウザを開発しているのですが、母港のjsonのHttpWebRequestを作成してHttpWebResponseをGetResponseするところで403Forbiddenエラーが発生していまいます。
また、こんな方法でも出来ると言うのがありましたらぜひお願いします。
↓に該当する部分のコードを載せます。
lang
1 2 String strUrl = webBrowser1.Url.ToString(); 3 if (strUrl == "http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854/" && webBrowser1.ReadyState == WebBrowserReadyState.Complete) 4 { 5 try 6 { 7 String portUrl = "http://203.104.209.23/kcsapi/api_port/port"; 8 HttpWebRequest req = (HttpWebRequest)WebRequest.Create(portUrl); 9 HttpWebResponse res = (HttpWebResponse)req.GetResponse(); 10 Stream st = res.GetResponseStream(); 11 RootObject.ApiMaterial port; 12 13 using (st) 14 { 15 var serializer = new DataContractJsonSerializer(typeof(RootObject.ApiMaterial)); 16 port = (RootObject.ApiMaterial)serializer.ReadObject(st); 17 } 18 }catch(WebException webExcp) 19 { 20 if (webExcp.Status == WebExceptionStatus.ProtocolError) 21 { 22 HttpWebResponse errres = (HttpWebResponse)webExcp.Response; 23 Console.WriteLine("{0}:{1}", errres.StatusCode, errres.StatusDescription); 24 } 25 else 26 Console.WriteLine(webExcp.Message); 27 }
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/04/10 09:14
2015/04/10 09:15
2015/04/10 12:49
2015/04/13 12:35