Capture HttpRequestMessage data

User avatar
TooTallTommyT
Posts: 19
Joined: Tue Aug 21, 2018 6:51 am
Location: Las Vegas, NV

Capture HttpRequestMessage data

Postby TooTallTommyT » Tue Sep 11, 2018 9:06 am

Since my page is going to be launched from a website after user login, I need to be able to pass along credentials, headers, user info and other relevant data to the app. Is there a way to capture HttpRequestMessage data inside my app? Is this something I can pull out using javascript?
It ain't easy being green!

User avatar
TooTallTommyT
Posts: 19
Joined: Tue Aug 21, 2018 6:51 am
Location: Las Vegas, NV

Re: Capture HttpRequestMessage data

Postby TooTallTommyT » Tue Sep 11, 2018 9:52 am

After doing more research, it would appear that using 'localStorage' would be a great way to go, but I am having trouble getting it to work. I thought it would be as simple as:

Code: Select all

var user = Interop.ExecuteJavaScript( "localStorage.getItem('User')" );
var roles = Interop.ExecuteJavaScript( "localStorage.getItem('Roles')" );


...of course after having set the proper values in the local storage to begin with....which I have, but the values returned are 'null'

Any ideas?
It ain't easy being green!

User avatar
TooTallTommyT
Posts: 19
Joined: Tue Aug 21, 2018 6:51 am
Location: Las Vegas, NV

Re: Capture HttpRequestMessage data

Postby TooTallTommyT » Tue Sep 11, 2018 10:29 am

That turned out to be the way after all. My trouble was that I had set the localstorage while on one tab and tried retrieving it from the app while it was on another tab. So, I modified my Landing page ( as a proof of concept ) to add localstorage info, then redirect to the app. Since it was in the same tab, my app was able find and retrieve the data.

Go Me!!! :lol:
It ain't easy being green!

User avatar
TooTallTommyT
Posts: 19
Joined: Tue Aug 21, 2018 6:51 am
Location: Las Vegas, NV

Re: Capture HttpRequestMessage data

Postby TooTallTommyT » Fri Sep 14, 2018 4:25 pm

Just found the:

Code: Select all

HtmlPage.Document.DocumentUri
...and the...

Code: Select all

HtmlPage.Document.QueryString
...with a trove of information!!!!

Yay!! :mrgreen:
It ain't easy being green!


Return to “General Discussion and Other”

Who is online

Users browsing this forum: No registered users and 28 guests

 

 

cron