partial trust WPF app

I'm trying to develop a WPF app that runs in a browser that only requires partial trust security. In v1 of WFP this is not supported, but in Orcas and .net 3.5 this will be added. I've tried creating simple apps to test this but I always get "Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, " exception. Has anyone sucessfully tested this new feature? How would I get a xbap app to run in a partial trust browser? Thanks
[490 byte] By [t4et] at [2008-1-5]
# 1

Hello,

We do fully support WPF partial trust browser applications in V1 of WPF. These are precisely WPF Xaml Browser Applications (XBAPs). XBAPs receive internet permissions by default, and are granted WebPermission back to the site-of-origin server. Can you tell me more about the application you are building? Do you try to access something from a server outside the originating domain of the XBAP?

I recommend you check out this link.

http://msdn2.microsoft.com/en-us/library/aa970910.aspx

Thanks,

Jennifer

JenniferLee--MSFT at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2

Hi Jennifer,

I'm interested in developing an XBAP application that is available via the internet. The samples I've created so far basically query a database and populate a list view, but an odd xaml parser exception is thrown. I've read in the .net 3.5 framework there will be support for partially trusted xbap application to function without installing a cert. How would I test the new partially trusted functionality of .net 3.5?

t4et at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 3

.NET 3.0 supports partial trust now ... no cert is required. only full trust XBAP apps require a cert.

for .NET 3.5, the only partial trust change I know about is that WCF client calls will work in partial trust (they dont in .NET 3.0). right now, if you have a partial trust XBAP app, then it has to use an ASP.NET client proxy to call a web service ... it cant use a WCF client proxy. but .NET 3.5 will change it so that you can use a WCF client proxy in a partial trust XBAP app.

it would help if you posted the xaml parser exception you are getting.

Thanks,

casey

kcchesnut at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 4

Sorry, I'm new to WPF\WFC framework. I realize partial trusted apps are supported in 3.0, but simple database calls throw security exceptions. So I figured I'd try .NET 3.5. I tried web service calls, not WCF, client calls in a .net 3.5 XBAP partial trust application, I get "Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, " Do the client calls need to be WCF? The XAML parser error seems to come up randomly, something like "Error on Line 1 position 7". I think that may be due to different versions of Visual Studio I have running. Thanks

Eric.R. at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 5

> I realize partial trusted apps are supported in 3.0, but simple database calls throw security exceptions.

A partial trust app cannot make a direct Connection to a database. That will not work in .NET 3.0 or .NET 3.5.

It has to use a Web Service call to get the data, and the Web Service will make the Connection to the database. Also, the WebService has to be hosted at the same domain the XBAP was served from. to emulate this when you are debugging in VS.NET, your command line arguments for debugging should look something like this :

-debug "C:\DEV\your.xbap" -DebugSecurityZoneURL “http://DomainWhereTheWebServiceIs/

That will make it look like the XBAP was served from 'DomainWhereTheWebServiceIs', and then it can make calls to that web service, because they have the same SiteOfOrigin.

e.g. if your XBAP is ultimately hosted at http://domain/your.xbap, then it can make a web service call to http://domain/YourWebService.asmx

casey

kcchesnut at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 6
I tried that and got this exception. I appreciate the help, I've been trying to figure this out for weeks. For the http://DomainWhereTheWebServiceIs/” I'm using "http://localhost:2410", would that be the problem? Any other suggestions?

"Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

Eric.R. at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 7
Anyone have any ideas? I'm completely out of luck on this. Thanks
Eric.R. at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 8

Eric, follow kcchesnut's guidance...

Beware that the same-site-of-origin restriction includes the port number. See this article for an in-depth discussion of "site of origin": http://blogs.msdn.com/shawnfa/archive/2006/07/15/665763.aspx.

Issues with accessing web services in XBAPs have been discussed many times before. Since I cannot tell what your specific problem is from the limited information you are providing, see first if any of the causes discussed here apply to your case:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1295502&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1436424&SiteID=1

ChangoV.-MSFT at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 9

Thank you for the response Chango. I've tried making the changes, but it still doesn't work. Do you still have the code referenced from this post? http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1436424&SiteID=1. If so could you make it available for me to download? At this point I'd be happy to see any example were this works. Thanks again!

Eric.R. at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified