# .NET and More > Silverlight >  2010 ASP.NET Silverlight 5 web app not firing events

## gixxer05

I have a solution that includes two projects.  One is a Silverlight folder browser project embedded into the a div on the second project's aspx page and runs as a Out of Browser application.  The problem I am experiencing is with the Silverlight folder browser project.  All functions operate as expected when running as the startup project, solely, by itself outside of the aspx page.  However no events are firing when running the Silverlight folder browser in the aspx page.  Nothing is triggering the breakpoints.  What could be the problem?  I can provide whatever code necessary.  Thanks.



```
namespace AccessingEntireFileSystemInSL5Beta
{
    public partial class MainPage : UserControl
    {
        EntireFileSystem fileSystem = null;

        public MainPage()
        {
            InitializeComponent();


            // Register script for opening browser in Preferences.aspx page - using via System.Windows.Browser;
            //HtmlPage.RegisterScriptableObject("Page", this);

            // Register Silverlight to be exposed in JavaScript 
            HtmlPage.RegisterScriptableObject("ScriptablePageObject", this); 

            fileSystem = new EntireFileSystem();

            this.folderName.Text = "Folder path : Not selected";

            this.lstFiles.ItemsSource = new List<string>() { "No files in the current folder ! " };

            this.myTreeView.DataContext = fileSystem.RootFolder;
            
        }


        private void myTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            Folder folder = e.NewValue as Folder;

            // If the folder is not null
            if (folder != null)
            {

                // If the full folder path is not null or empty, and child folders do not exist or the folder title is My Computer
                if ((!string.IsNullOrEmpty(folder.FullPath)
                       && folder.ChildFolders.Count == 0)
                       || folder.Title.Equals("My Computer"))
                {

                    // Load the subfolders for the top level folder, and show the directory
                    fileSystem.LoadSubFolders(folder.FullPath, folder);

                    // Show the current folder selection
                    this.folderName.Text = "Folder path : " + folder.FullPath;
                }

                // Create a list to hold the file info for the selected folder
                List<string> fileInfo = new List<string>();

                try
                {
                    foreach (string fileName in Directory.EnumerateFiles(folder.FullPath))
                    {
                        FileInfo file = new FileInfo(fileName);
                        string size = (file.Length / 1024 / 1024) == 0
                                      ? "Less than 1"
                                      : (file.Length / 1024 / 1024).ToString();
                        fileInfo.Add(file.FullName + " |  Size : " + size + " MB |  Created on: "
                                                   + file.CreationTime);
                    }

                    // The following displays a message if there are no files in the selected folder
                    // This is not required for this project
                    if (fileInfo.Count == 0)
                    {
                        this.lstFiles.ItemsSource = new List<string>() { "No files in the current folder ! " };


                    }
                    else

                        // Else, there are files in the folder, so show the file's info
                        // held within the fileInfo list of strings
                        lstFiles.ItemsSource = fileInfo;
                }

                    // Catch the exception that will occur when initiating from the top level 
                catch (Exception) { }
            }
        }




        private void RefreshMyComputer(object sender, RoutedEventArgs e)
        {
            fileSystem.LoadFolder();
            myTreeView.ItemsSource = fileSystem.RootFolder;
        }

        // This function is called from the Apply button and sends the value of the selected path
        // to the asmx page
        [ScriptableMember]
        public void btnApply_Click(object sender, RoutedEventArgs e)
        {
            HtmlPage.Window.Invoke("getFolderPath", folderName.Text);

        }

    }
}
```



```
<div id="SilverlightControlHost" class="slidingDiv" style="display: block;">

                    <object ID="SilverlightPlugin1" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="508px" height="350px">
                    
                        <param name="source" value="ClientBin/AccessingEntireFileSystemInSL5Beta.xap" />
                        <param name="onerror" value="onSilverlightError" />
                        <param name="background" value="white" />
                        <param name="minRuntimeVersion" value="4.0.60310.0" />
                        <param name="autoUpgrade" value="true" />
                        <param name="isWindowLess" value="true" />

                        <!-- Display installation image. -->
                        <a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=4.0.60310.0" style="text-decoration: none;">

                        <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style: none"/>
                    
                        </a>
                    </object>
                    <iframe id="_sl_historyFrame" 
                        style='visibility:hidden;height:0px;width:0px;border:0px'>
                    </iframe>

                </div>
```

----------

