472,952 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

Pass parameters to XBAP from webpage

I'm creating a XBAP application and want it take some input from webpage
dynamically? what is the best way? how to do it?

Best Regards
Steven

--
=======================
Steven Tang
SYWWUYU)
**:)
Oct 9 '08 #1
2 11233
Hello,

Welcome to Microsoft Newsgroup Support Service! My name is Marco Zhou. It's
my pleasure to work with you on this thread.

If I understand you correctly, you need to pass some data from ASP.NET web
pages to the XBAP application, if this is the case, there are two options
you could try out:

First option:

You could use cookie to pass data to XBAP application as follows:
At the codebehind of ASP.NET web page, you could simply write something
like the following:

// Construct the cookies.
HttpCookie cookie = new HttpCookie("MyData");
cookie.Value = HttpUtility.HtmlEncode("MyData");

//Add to the response stream
Response.Cookies.Add(cookie);

// Redirect the page to XBAP delopyment URI.
Response.Redirect("http://localhost/XBapCookieDemo/XBapCookieDemo.xbap");

And in the XBAP application, you could retrieve the cookie using the
following method:

try
{
String cookie = Application.GetCookie(BrowserInteropHelper.Source) ;
MessageBox.Show(cookie);
}
catch (Win32Exception)
{
}

Second option:

You could use query string to pass data to XBAP application, at the
codebehind of ASP.NET web page, you could write something like the
following:

String data = HttpUtility.UrlEncode("MyData");

// Pass the data using query string.
Response.Redirect("http://localhost/XbapCookieDemo/XbapCookieDemo.xbap?MyDat
a=" + data);

And in the XBAP application, you could retrieve the data using following
method:

String queryString = BrowserInteropHelper.Source.Query;
if (queryString != null && queryString.Length 0)
{
MessageBox.Show(queryString.Trim('?'));
}

If you want to pass data after the XBAP application has launched, you could
try creating an ASMX or WCF service at the XBAP deployment site, so that
you could communicate data to XBAP application via ASMX and WCF service.

If you have any further questions on this issue, free feel to ask here, we
are glad to answer them.

--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 10 '08 #2
Thanks a lot for helping:)
--
=======================
Steven Tang
SYWWUYU)
**:)
"Marco Zhou [MSFT]" wrote:
Hello,

Welcome to Microsoft Newsgroup Support Service! My name is Marco Zhou. It's
my pleasure to work with you on this thread.

If I understand you correctly, you need to pass some data from ASP.NET web
pages to the XBAP application, if this is the case, there are two options
you could try out:

First option:

You could use cookie to pass data to XBAP application as follows:
At the codebehind of ASP.NET web page, you could simply write something
like the following:

// Construct the cookies.
HttpCookie cookie = new HttpCookie("MyData");
cookie.Value = HttpUtility.HtmlEncode("MyData");

//Add to the response stream
Response.Cookies.Add(cookie);

// Redirect the page to XBAP delopyment URI.
Response.Redirect("http://localhost/XBapCookieDemo/XBapCookieDemo.xbap");

And in the XBAP application, you could retrieve the cookie using the
following method:

try
{
String cookie = Application.GetCookie(BrowserInteropHelper.Source) ;
MessageBox.Show(cookie);
}
catch (Win32Exception)
{
}

Second option:

You could use query string to pass data to XBAP application, at the
codebehind of ASP.NET web page, you could write something like the
following:

String data = HttpUtility.UrlEncode("MyData");

// Pass the data using query string.
Response.Redirect("http://localhost/XbapCookieDemo/XbapCookieDemo.xbap?MyDat
a=" + data);

And in the XBAP application, you could retrieve the data using following
method:

String queryString = BrowserInteropHelper.Source.Query;
if (queryString != null && queryString.Length 0)
{
MessageBox.Show(queryString.Trim('?'));
}

If you want to pass data after the XBAP application has launched, you could
try creating an ASMX or WCF service at the XBAP deployment site, so that
you could communicate data to XBAP application via ASMX and WCF service.

If you have any further questions on this issue, free feel to ask here, we
are glad to answer them.

--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Scott Townsend | last post by:
I'd like to pass parameters to a local Application from a webpage. something like: <a href="file:///C:/Program%20Files/myapp/myapp.exe%20-custno:mycustno%20-quote no:12345%20-item:12345">test...
13
by: Al Franz | last post by:
Anyone understand how to pass parameters to a JavaScript. If anyone finds this easy to do maybe they could take a look at my short script on this page and show me how it needs to be changed. ...
5
by: Ben | last post by:
Hi I am using a User Control which is referenced by an ASPX page. How can I pass a string parameter to the user control, from the base ASPX page. Thanks Ben
6
by: Woody Splawn | last post by:
I am using SQL Server 2000 as a back-end to a VS.net Client/Server app. In a certain report I use a view as part of the query spec. For the view, at present, I am querying for all the records in...
3
by: Wang Xiaoning | last post by:
I have an customerdetail.xsl sheet ---------------------------------------------------------- <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0"...
3
by: Joseph Lu | last post by:
Hi, all I have a stored procedure created in SQL Server like the following lines. // stored proceudre code starts here CREATE PROCEDURE sp_insertdata @strdata varchar(250) , @rsult BIT...
0
by: raghuraman_ace | last post by:
Hi i have started a webservice wich has a webmethod with parameters using literal encoding & encoded encoding . The webservice is compiled successfully . But i don know how to pass the...
0
by: PriyaManasarovar | last post by:
Can someone help how to pass parameters to a crystal report using a Crystal report object? I am using a console application & hence crystal report viewer cannot be used. And i need to pass the...
3
by: Aussie Rules | last post by:
Hi, I have a few aspx (.net2) form. The first form allows the user to enter into text box, and select values from drop downs The second form needs to use these values to process some data....
3
by: Vajrala Narendra | last post by:
Hi all Hi all, In my WF Project i have a CodeActivity, that is to check wether entered userid, password are valid or not how to pass parameters to CodeActivity. what i tried is in my class i...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.