473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 11278
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.