I am a sophomore student, because the school's education online has not out of the Windows Phone's Dean online, and itself is also interested in WP development, so try to develop
Because there is no systematic learning, only in the groping forward, the rationale behind this is very simple, not easy to achieve, the web is not suitable for the tutorial, the following is I try to write the code of the login page,
But there are some grammatical problems, I hope to have the help of the noble.
usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Net;usingSystem.Runtime.InteropServices.WindowsRuntime;usingwindows.foundation;usingWindows.Foundation.Collections;usingWindows.UI.Xaml;usingWindows.UI.Xaml.Controls;usingWindows.UI.Xaml.Controls.Primitives;usingWindows.UI.Xaml.Data;usingWindows.UI.Xaml.Input;usingWindows.UI.Xaml.Media;usingWindows.UI.Xaml.Navigation;usingSystem.Collections.Specialized;usingSystem.Text;usingSystem.Xml.Linq;usingSystem.Threading.Tasks;//The blank page item Templatehttp://go.microsoft.com/fwlink/?LinkId=391641on the introductionnamespaceapp3{/// <summary> ///a blank page that can be used for itself or to navigate inside a Frame. /// </summary> Public Sealed Partial classMainpage:page { PublicMainPage () { This. InitializeComponent (); This. Navigationcachemode =navigationcachemode.required; } //This is a button event, when clicked will log in to the Dean online and jump to another page to display course Information Private voidButton_Click (Objectsender, RoutedEventArgs e) { //this is to call the following method, do not know right, I hope the garden friends to helpAsyncCallback CallBack =NewAsyncCallback (Readcallback); } Private voidreadcallback (IAsyncResult asynchronousresult) {//This is the URI of the login page stringLoginuri ="http://60.18.131.131:11080/newacademic/common/security/login.jsp"; HttpWebRequest Request=(HttpWebRequest) webrequest.create (Loginuri); //set up some information for postRequest. Method ="POST"; Request. ContentType="application/x-www-form-urlencoded"; Request. Credentials=NewNetworkCredential (TextBox1.Text, passwordbox.tostring ()); HttpWebResponse Response=(HttpWebResponse) request. EndGetResponse (Asynchronousresult); //Get CookiesCookiecollection cookies =Response. Cookies; //This is the URI that is already logged in stringPostURL ="Http://60.18.131.131:11080/newacademic/j_acegi_security_check"; HttpWebRequest req=(HttpWebRequest) webrequest.create (PostURL); //req. Cookiecontainer = new Cookiecontainer (); //req. Cookiecontainer.add (Posturl,response. Cookies); //How cookies are added to the request is yet to be explored.Req. headers["Cookies"] =cookies. ToString (); //I got the stream back here.Stream stream =req. EndGetRequestStream (Asynchronousresult); StreamReader SR=NewStreamReader (stream); stringContent =Sr. ReadToEnd (); //put the stream in another pageFrame.navigate (typeof(BlankPage1), content); }
The logic is basically to first simulate landing, then get a cookie, and then take this cookie to access the landing page, (and then by parsing HTML to get the content you want, this part has not been done)
But there are still some questions, I hope the experienced Park friends to guide
About the Windows Phone Dean online client