• Upgrade your Internet Experience
  • Sign in
  • Microsoft.com
  • United States (English)
    Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
.NET Framework Developer Center
 
 
Home
 
 
Library
 
 
Learn
 
 
Downloads
 
 
Support
 
 
Community
 
 
Forums
 
 
 
.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > WindowsFormsHost Problem When Publishing XABP Application
Ask a questionAsk a question
Search Forums:
  • Search Windows Presentation Foundation (WPF) Forum Search Windows Presentation Foundation (WPF) Forum
  • Search All .NET Development Forums Search All .NET Development Forums
  • Search All MSDN Forums Search All MSDN Forums
 

AnswerWindowsFormsHost Problem When Publishing XABP Application

  • Monday, June 30, 2008 12:35 PMi-developer Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
     Hello,

    In our application we want to play flash(swf) files. We did via windowsformshost control which come in netfx 3.5 help on a component. When you use windowsformshost control in your application you must set security level to "Full Trust" in Security Property of the Project.  It's okey. It's working fine but when we want to Publish the Application. We can not do it. We get that error message.

    How can we achieve? Let's discus.


    Cannot create instance of 'Page1' defined in assembly 'SanalTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Page1.xaml' Line 1 Position 7.

    Line1: 

    <Page x:Class="SanalTest.Page1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Page1" Loaded="Page_Loaded">

     


    sometimes i feel my self like a "." that i am at end of an meaned sentences or begining of it.
    • ReplyReply
    • QuoteQuote
     

Answers

  • Monday, June 30, 2008 4:31 PMMatt Galbraith - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Vote As Helpful
    0
    Hi,
        You've published a full-trust .xbap but have not mentioned taking the necessary steps to run it from anywhere other than the local file system.  Since .xbaps currently cannot ask the end user for elevated trust (i.e. greater than the zone they're coming from in CAS terms), they are either granted it or they refuse.   From the description you give, your .xbap is still running in partial trust (since it's allowed to run before it fails) but crashes with a SecurityException when (expectedly) instantiating the WindowsFormsHost conrol.  However, given you simply want to show .swf, the WebBrowser control might be all that you need. 

    Here's some suggestions:

    To remotely deploy your .xbap with Full Trust (Once it's actually set that way)
    - Export the certificate (.cer) that your application's manifests (.xbap and .exe.manifest) are signed with.  Do not distribute .pfx files, as this contains your personal signing key.
    - Have anyone who wants to run the app remotely import this .cer to both their Trusted Publishers store and Trusted Root Certification Authorites store (second step only needed for self-generated keys).

    To show arbitrary .swf inside your WPF app...
     You can probably just use the WebBrowser control (i.e. set the "Source" Property on a Frame control to HTML which wraps the .swf in a full-sized frame.  With this approach and passing info to the inner html via URL parameters, any version of .NET can load arbitrary .swf inside a WPF app.  With .NET 3.5 Sp1, (see blog post here, not on main MSDN pages yet) you will be able to have some level of interop communication between script running in the HTML and your app, so you could even do things like driving a media-player type element in the HTML.

    Hope this helps,
    Matt
    SDET : Deployment/Hosting
    • Marked As Answer byi-developer Tuesday, July 01, 2008 8:56 AM
    •  
    • ReplyReply
    • QuoteQuote
     

All Replies

  • Tuesday, July 01, 2008 8:25 AMi-developer Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    Hi,
    Your explation was excelent. Thank you so much. We did second way before but we wasn't succesfull. So we tried to did first way which is more securable for everyone.

    We Published The Application. We Import the Certifcate into  Trusted Pubisher and Trusted Root Cer. from Internet Explorer Tools/Internet Options/Content/ Certificates Tab.

    It was successfully. :) Thank you very much.
    • Edited byi-developer Tuesday, July 01, 2008 8:55 AMSolved Problem
    •  
    • ReplyReply
    • QuoteQuote
     
Need Help with Forums? (FAQ)
 
© 2009 Microsoft Corporation. All rights reserved.
Terms of Use
|
Trademarks
|
Privacy Statement