Results 1 to 5 of 5

Thread: WPF XAML Question -

  1. #1

    Thread Starter
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,614

    WPF XAML Question -

    I have an XAML file that I am loading in IE 7. I get the following:

    Code:
    Startup URI: C:\Users\Brad!\Desktop\RSS.xaml
    Application Identity: file:///C:/Windows/Microsoft.Net/Framework/v3.0/WPF/XamlViewer/XamlViewer_v0300.xbap#XamlViewer_v0300.application, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c3bce3770c238a49, processorArchitecture=msil/XamlViewer_v0300.exe, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c3bce3770c238a49, processorArchitecture=msil, type=win32
    
    System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
       at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
       at System.Security.CodeAccessPermission.Demand()
       at MS.Internal.PresentationFramework.SecurityHelper.DemandUnmanagedCode()
       at System.Windows.Window..ctor()
    ... The list goes on, but the above gives enough detail I believe. I'm guessing I have a simple setting wrong or something. I thought I got around this before, but I've hit the wall again. Maybe it is simply too late in the day after doinng too much .

    Anyone have a suggestion for me to get around this so I can run the XAML file?

    Thanks,

    Brad!


    The XAML file I want to run:

    Code:
      <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              Title="My RSS Reader">
    
        <Window.Resources>
          <XmlDataProvider x:Key="Blog"
            Source="http://www.codeguru.com/icom_includes/feeds/codeguru/rss-all.xml" />
        </Window.Resources>
        <DockPanel
        DataContext="{Binding Source={StaticResource Blog}, XPath=/rss/channel/item}">
          <TextBox DockPanel.Dock="Top"
            Text="{Binding Source={StaticResource Blog}, 
             BindsDirectlyToSource=true, Path=Source, 
             UpdateSourceTrigger=PropertyChanged}" />
          <Label DockPanel.Dock="Top" Content="{Binding XPath=/rss/channel/title}"
                 FontSize="14" FontWeight="Bold" />
          <Label DockPanel.Dock="Top"
            Content="{Binding XPath =/rss/channel/description}" />
          <ListBox DockPanel.Dock="Left" DisplayMemberPath="title"
          ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" Width="300" />
          <Frame Source="{Binding XPath=link}" />
        </DockPanel>
      </Window>

  2. #2
    New Member
    Join Date
    Jan 2007
    Posts
    2

    Re: WPF XAML Question -

    When you navigate in IE to a XAML file, it is running in a "sandbox".
    Inside that sandbox (of lower privileges for the code), Window isn’t allowed. (We want to avoid pop-ups).
    So if you replace the 4 instances of “Window” with “Page”, it should work fine.
    Thanks, Rob Relyea
    Program Manager, WPF Team
    http://rrelyea.spaces.live.com

  3. #3

    Thread Starter
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,614

    Re: WPF XAML Question -

    Quote Originally Posted by RRelyea
    So if you replace the 4 instances of “Window” with “Page”, it should work fine.
    http://rrelyea.spaces.live.com
    That makes sense. Thanks.

    Unfortunately, I had already tried that, but I hit an error in that Page.Resources isn't an option. As such, where would I put XmlDataProvider setup?

    Correction -
    I pulled this into Visual Studio (hadn't been using it). Page.Resources is an option. Unfortunately, my code is throwing an exception.

    Brad!

  4. #4

    Thread Starter
    ex-Administrator brad jones's Avatar
    Join Date
    Nov 2002
    Location
    Indianapolis
    Posts
    6,614

    Re: WPF XAML Question -

    Code:
    Startup URI: C:\Documents and Settings\Brad!\Desktop\XAML\RSS2.xaml
    Application Identity: file:///C:/WINDOWS/Microsoft.Net/Framework/v3.0/WPF/XamlViewer/XamlViewer_v0300.xbap#XamlViewer_v0300.application, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c3bce3770c238a49, processorArchitecture=msil/XamlViewer_v0300.exe, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c3bce3770c238a49, processorArchitecture=msil, type=win32
    
    System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
       at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
       at System.Security.CodeAccessPermission.Demand()
    Seems like the same type of error only related to the web.

  5. #5
    New Member
    Join Date
    Jan 2007
    Posts
    2

    Re: WPF XAML Question -

    this is likely related to the fact that your xaml file and the xml file are from 2 different domains??

    At least that is what I would investigate...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width