Accessing http query string in a xaml file - xaml

If an HTTP request is made to an asp web page, then the asp code can access the query string via the Request.QueryString object.
What's the analagous way to do this in XAML? For example, say that I wanted to write a simple XAML page that just echoes the query string back in the response. What would the code for this look like?

Since you mention query strings and responses, I'm assuming you're talking about XBAPs (ie WPF applications hosted in the browser).
Check out this blog post:
How can I pass Querystring parameters to my WPF XBAP Application?
Once you've got the ApplicationDeployment.CurrentDeployment.ActivationUri value as a string it should be fairly trivial to pump it into a TextBlock on a page. Heck, you may be able to bind directly to it if you wanted to go that far.

Related

vb.net POST variables

I am performing an integration to a third party site and they have asked me to redirect to their URL with a bunch of POST variables.
The only way I can work out how to do this is by creating an HTML form with hidden fields, and then trigger a JS click event on a button to POST the form to their site.
Ideally I would like to do this from the VB code as the data may be sensitive and there are bits I don't want to render in the client side.
Has anyone any experience of doing this successfully. I have googled around but can only find ways to use GET variables on the URL or POST and read the response.

Pass query string to Page Viewer Web Part

I have a share point page, in which I have added a page viewer web part. This web part needs to be supplied with a query string in addition with the static URL.
I tried putting a QueryString Filter Web Part but it did let me connect with the page viewer web part(Message - the connection type send parameter values is not compatible with any web part on the page)
I was wondering whats the correct way to achieve this. Thanks
I got going...
The solution is to create your own visual web part. Visual web part is not but a user control which a web part loads in in CreateChildControl method.
Now you have access to code behind, Sharepoint Context, you can do what ever you want.
How to create Visual Web Part

Gwt accessing Session id in Client side

atm i have a JSP (my Host page) where i set the Session id via scriptlet with the Request Object. I save this Information in an hidden field and read it with the gwt DOM Object. Is there à better way to do this ? Thanks in advance for help.
Kuku
Depending on your setup this is a valid way to get a hold to a session ID. I assume you have written just a part of you web application in GWT and integrate it into something bigger written in some other language. Since your host page is JSP, I assume the non GWT part of your application is also dynamic.
I don't think that the proposed solution using a GWT service call works in this case. Since you can not match the session ID on the server to the incoming AJAX call.
Instead of using a hidden field, you could encode the session ID in the URL and get it from there, see getParameter(...):
http://google-web-toolkit.googlecode.com/svn/javadoc/2.2/com/google/gwt/user/client/Window.Location.html#getParameter%28java.lang.String%29
But I actually prefer the solution with the hidden filed, because it does not affect the URL. If you encode transient information in the URL you may lose the ability to bookmark it.

dojo ajax dropdownlist

I am trying to set a web application using ajax dojo technology. For this I need an exemple showing how to send and receive data with dojo library.I use also J2ee in my project.
Please if you have a constructive example show it to me.
Client side: JSP with ajax dojo its purpose is to send a selected item to the server side.
Server side:Servlet catch the data sent and construct sql query with it finally send it again to jsp
JSP receive the result of the query (xml file)
dojo construct the seceond dropdownlist automaticallt.
Just i need an exemple of send and receive.
Many Thinks.
Have you looked on Dojo's website? From your question, it sounds like what you want is dojo.data.ItemFileReadStore. The Dojo website has many examples of the uses of ItemFileReadStore, including one in which one FilteringSelect is dependently linked to another, which seems to be what you describe.
As to your request for examples of send and receive in JSP: a Google search for JSP tutorial turns up a site called jsptut.com as the first result. Have you looked there?

Retrieving dynamic text from a website in vb.net (VS2008)

I want to be able to retrieve dynamic data from a web page (share prices). I started out by retrieving the html code before I realised that as it is live data, the html code will be of little use. Although I am looking to capture specific data, all i wish to do is process a webpage that I specify which will return the text off that website and not the HTML code. Basically a copy and paste of the entire page would be great..
Any ideas would be really appreciated!
'Screen Scraping' by parsing HTML is so early 2000s...what I would do is read up on Amazon's Mechnical Turk. You can develop a queued architecture where you submit urls to this Mechnical Turk service. The service would automatically distribute these bits of work to users who would then do the dirty task of copying and pasting out the valuable stock quote information you require. Users around the world would anxiously await delivery of the next URL to their Mechanical Turk inbox...pinning for the opportunity to copy/paste out another share price for your application. Sure, it might take a few minutes to update your prices, but hey, they would be HAND parsed by REAL people around the globe! Just think of the possibilities!
Well, the HTML contains the text of the website, so you "just" need to parse the HTML.
EDIT: If the data is not in the HTML but loaded dynamically, the situation is different. As I can see, you have two options:
Find out how the data is loaded (i.e. read the JavaScript on the page). If it is updated via some web service, you could query the same web service in your program.
Use a web browser to get the data and then get the dynamic HTML tree of the page. Maybe the WPF Webbrowser control can help you with this, but I'm not sure since I've never done this myself.
Is it possible to find this same data provided in a ready-to-consume format rather than scraping HTML for it? It seems like there's probably public web-services for stock quotes.
For example: A quick search for "Stock price webservice" turned up http://www.webservicex.net/stockquote.asmx; an ASMX web-service that is easy to consume in .NET.
In your Visual Studio project you should be add a reference to this service via the "Add Web Reference" command; the dialog you're given varies depending on whether your project is targeting for .NET 2.0 or .NET 3.0/3.5.
I added a reference to the service named StockPriceProxy:
Public Function GetQuote(ByVal symbol As String) As String
Using quoteService As New StockPriceProxy.StockQuote
return quoteService.GetQuote(symbol)
End Using
End Function