Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Get content of a WebView as a string

Is it possible to get the content of a WebView as a string?

I tried using:

HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(Constants.LOGIN_URL);

HttpWebResponse response = (HttpWebResponse)await httpWebRequest.GetResponseAsync();

But I didn't get what i wanted because the webview stores the sessions etc.

I want a method to get the data of a logged in user from a website if this is possible.

Answers

  • adamkempadamkemp USInsider, Developer Group Leader mod

    There is a GetResponseStream method that you can call on the response object that should give you a Stream from which to read the data.

  • AntonioPapaAntonioPapa USMember

    Hi @adamkemp

    Yes I know this method I used the Stream that it generated but was not what I was looking for. For example in the webview I was logged in as John Doe but when I used the WebRequest method it stated "Please Log In", the session was not stored. Thats why I wanted to take the content of a webview.

  • adamkempadamkemp USInsider, Developer Group Leader mod

    You'll have to use a custom renderer for that because there isn't currently an API for providing that in a PCL.

Sign In or Register to comment.