How can I create a hybrid Silverlight and aspx application - asp.net

Here is my scenerio..
We have an ASP.Net 2.x web site. We want to migrate it to Silverlight full frame application. However, there is no way we can go away in a corner and redo every web page in SL right off the bat.
What I would like to do is build the chrome of the app (main page, dashboard, login, common system/config screens, main menu) in SL and be able to open existing .aspx pages in the main content SL frame.
From what I see there is no way to do this. I thought the Webbrowser control in SL4 would be the answer, but apparently that only works if your app is run out of browser.
So, what is my best recourse? It seems like I will have to create some type of .aspx page that hosts the .XAP and pass in the page I want it to load?
How would you gurus approach this?

I would actually go the opposite route actually. Intead of building the full dashboard, i would begin building the dashboard elements separately as much as you can. This will give you time to refactor your individual applications one by one until you're ready to integrate them all.
One method we considered on my team was to build our SL rendering engine to render our aspx into SL controls, but when we saw the scope of that we decided it would be easier just to begin developing everything in SL from scratch.

Related

IIS smooth streaming does not play a video on asp.net MVC 4 with Razor

I am trying to get a basic demo working but can't succeed, I've spent hours and hours on it..
I am building an iis smooth streaming player with no controls at first that auto plays the video, I am using "MMP"- Microsoft media platform which was formerly "SMF"- Silverlight media framework, the example I am using to build a smooth streaming player is here on the middle of this page: http://smf.codeplex.com/documentation
A brief explanation of the issue I am facing:
I am sure I got everything right in terms of the player itself, I got the .ism file, i can view its manifest if I browse to it with the browser, I can even get everything to work and play the video in an html file that is running straight from an IIS website.
another key note: I can also run any test silverlight application for example, the main form with a button and a few radio buttons and I do get this application to run and display. the problem happens only when I try the smooth streaming player, it gives a black and blank page for the whole page and right clicking shows "silverlight".
so the problem starts when I try to run it from a Silverlight application that is hosted in an asp.net MVC 4 (with Razor) application.
I have an asp.net MVC project in visual studio and then I add a silverlight application to it and choose to host it in the MVC application, then I follow the same routin as for the silverlight application player building and it even renders and plays the video on the visual studio's silverlight XAML design page. I build the whole solutio and then I get a "silverlightApplication1.xap" file in a "ClientBin" new folder on the MVC application and also a test html file and an test aspx file again in the MVC application.
if I make sure the linking is correct I can take this html file to another IIS website and run it from there and it works and plays! but if I try to run it straight from within the application (view in browser) for the html/aspx files it says that it's not running on the platform/fabric of the website and for the silverlight application itself it opens the same blank silvelight application with a black screen and also a URL of file:// and not http://localhost.. etc', so what I was trying to do for a long time is to make the silverlight application work as a view in the MVC application.
so I took a view and deleted everything in it and gave it a property of Layout=""; (nothing) and then I put the content of the test html file the SL application produced earlier, modified the value for the silverlightapplication path etc', when built and ran, the page comes up, even the application comes up as I see "Silverlight" on a right click of the mouse but the whole screen is just plain black again and it doesn't play the video.
I had the .ism file on anther location or a an entirely different location like another online website.
I also can't get to view the manifest when I run the MVC application it says its 404 but I am not sure if it's an MVC platform thing that it won't let me get to it or it's just not getting to it but the files are there and the URL's are correct both in the code and also in the URL i am putting in.
I have also came to the understanding that I might need to make sure the silverlight application is allowing cross domain traffic and it has a Client access policy like seen on this page: http://msdn.microsoft.com/en-us/library/cc838250(VS.95).aspx , so I've added two XML files to the root folder for these two issues. trying to figure out what's going on with firefox's web developer gives nothing as for what happens..
Please Help! Thanks! :)
Ray.
I don't know why and I have tried everything+making sure I get the manifest content if i browse to it.
it just worked with this URL for the ism file:
http://video3.smoothhd.com.edgesuite.net/ondemand/Big%20Buck%20Bunny%20Adaptive.ism/Manifest
there was no need for cross domain xml and Client access policy xml.

ASP.NET MVC full offline website

I made an ASP.NET MVC application which allows user to create dynamic websites. I need to add feature which will allow to download from server off-line version of choosen website as static html files with menu, hyperlinks, images, documents etc. It should work similar to applications such as Teleport Pro, but I have to choose from Admin Panel which content should be export.
Client wants to burn static website on CD, save on pendrive.
Do you have any ideas how to begin? Please help.
I currently have implemented that in a current project...
User is able to change anything in the frontend and at the end he can publish and download the offline files... the site subscribe users and show all prizes, winners and more information about that campaign.
All was done in ASP.NET MVC3 under .NET4 and hosted in AppHarbor.
It's composed at several applications but for what you want, you develop the Backend and the Frontend, and to generate the static files, simple use the Frontend to grab the full HTML
As an example, I can show what 2 users did...
Callme.dk did http://callme.julekal.info and
Sony Nordic did http://sony.julekal.info
plus, you can simply point custom domains to it as well like http://sonynordicxmas.net/
To publish and generate all files:
one part of the editing:
So I give the users, offline access (through the .zip file), online access (through the frontend application) and the ability of using custom domains...
I think the only way this might be possible is if you go to every single page and then use your browser to "Save" the web page script and all.
However this causes several issues;
You never quite get everything and you need to massage the HTML produced, dowload all the images etc to get the page to look right
Each html file now has an associated folder with the same name and each time you do this you will get another html file with a folder. You can combine all the folders into a single one but that leads me to item 3.
You will need to edit each html file to clear up any pathing issues if you want to share a single source folder.
Data is no longer dynamic!
You need to, if you want to link all the pages to each other, edit every single html file and resolver the anchor tags.
This is too much work and I think it actually breaks the true requirement.
Don't do it! :)

Can someone give me an overview of ASP.net and how it's different from technologies such as php?

I've been doing the html and css for a site, sending it off to a guy to implement in a web server. I get a call from the designer freaking out about the progress, saying the clients aren't happy. He wants me to personally integrate my css with what's on the site. The site is done in ASP.net, time is short, and I'm a little in over my head. I have an understanding of how php works, but have never worked extensively with it.
Looking at the stuff on the ftp, I can't even find equivalent of the index.html file (I know that when I go to the site itself, there is nothing after the base url, i.e., www.site.com/ brings me to the homepage.)
Can anyone give me a few tips or links as to what I am to do with this, or where to even being navigating this site?
EDIT: It's -not- a .Net Web Application, from the looks of it.
ASP.Net can be run in a compiled or a scripted environment. It is important to understand which environment your client has. If it is completely scripted, then you are likely looking for the default.aspx file and it's contents. If it is a compiled environment, you may be in for a ride. A compiled site may incorporate "master pages" as a templating engine, and then you'll need to apply your html/css modifications in several places.
You should start with the default.aspx page if there is one. Look for master page directives (it'll be named something like masterpage.master). If there isn't one, then you're in luck you'll just need to implement your changes on a page by page basis. The aspx page will be in a templated xml format so avoid touching tags that involve touching
If you are making changes to divs and structures of that nature, you may need to modify the CssClass attribute of the controls. I would recommend however that you make a back up, give it a shot, and under no circumstances attempt to do something that you aren't really ready to do. You will only anger the client and ruin your rep. It may actually be prudent to contact an actual ASP.Net developer to analyze the files separately and determine what you need to do.
I suggest that you read the Wikipedia article about ASP.NET to get familiarized with it as it summarizes the basic building structures.
Then, just to get you started: take a look at the more recent ASP.NET MVC (Model-View-Controller) paradigm. There's also development in what is called ASP.NET WebForms.
For example: when you go to www.site.com/ (known as friendly URLs) it may be redirecting you to an action method inside a controller. It's called routing. There's also URL rewrite.
In the MVC world a Controller can send/redirect the user to a specific View/Page.
A View (.aspx form/page) that contais HTML markup and CSS on the server side is basically an HTML page (.htm) page that'll be rendered on the client side.

Using master pages with multiple entities

I'm beginning to plan a complete redesign of our departments intranet pages. As it stands, every department gets their own folder within root. They all share the same look and feel but don't use CSS everything in each file is straight up static text. Basically, if a change has to be made to the header, every file must get changed. The number of files is somewhere in the hundreds. Since we're in the process of getting a new look & feel, I figured this would be the appropriate time to redesign the structure as a whole as well. My idea was to create a new C# Web Project to utilize the C# Master Pages. Within that project, each page would use the master page. Since I know they like to make many minor cosmetic changes, master pages would make things much simpler and quite frankly, I don't have time to manually edit a header 564 (random) times. The other aspect of this site is that the root would contain a documents folder within sub folders pertaining to each fo our departments.
Guess my question is, has anyone tackled an issue like this and could shed some light as to how they fixed it.
Also, would it be worth upgrading IIS and .NET to their latest version?
If you are already working in .NET 2.0, then you shouldn't need to do any upgrades, and there won't be any additional infrastructure cost.
I would highly recommend using Master pages, as they do make it painless to have a common look and feel for your entire site.
Another cool feature of Master pages is that you can nest them together. This would let you have a common feel between all pages. And then each department would have it's own Master page nested into your top-level page.
I'll start with the cost question. You need to be using ASP.NET 2.0 or higher to take advantage of master pages. Technically the .NET framework is free, however Visual Studio is not. Visual Web Developer is free, but the license might be for non-commercial projects only. I'm not sure. IIS is also free, Windows Server 2008 is not. You are fine running on XP or Server 2000/2003. There isn't really any reason to upgrade.
I can't say that I have tackled a problem exactly like yours, but it sounds like what you need is a content management system. Some examples are the cuyahoga project, or Umbraco. These systems allow you to create a general look and feel, and store all content in a database or xml files and provide an online content editor, so the content of the pages can be managed by people that don't necessarily know HTML or Programming.
You can have a master-page hierarchy:
Master page for everyone
Master page for department A
Master page for department B
Whatever's common for everyone you set in the first master page.
Then you make a master page for department A pages - this master page's master page is the first one.

How to consolidate ASP.NET master pages across applications?

First shot at throwing a question on these boards so hopefully I can get some help, here goes:
I am working to start up the .NET practice at my client. We have 5 small scale .NET applications in place currently with a few them of them live into production. They're mostly small reporting pieces with some data entry/business logic functionality. Each of these applications is currently using the identical master pages.
What I mean is that there is a copy of the same master page in each application. They are all basic website->WCF->BL->DB tiered applications. So I have 4 copies of the same master page that I have to change when I make a change to it.
The client DOES NOT want to consolidate all of these into a single solution. They like the separation of applications across sites. I just don't want to continue dealing with the hassle of multiple updates for common elements (which there will be many more of across these applications).
The code is all stored in team foundation server. We also do NOT want to compile the master page into a .dll and deploy it.
Can anyone please make some suggestions as to how I can maintain a single copy of these common files (master, .css, etc) across my multiple applications.
thanks in advance
You might want to look at Sharing Master Pages in Visual Studio.
If that is no help then you could try using Build Events in Visual Studio. I would pick one of the projects to be my "Main Project" and only edit the master page from that project. When you build the project it would run a command that would copy that master page(if it had changed) to your set locations.
The client DOES NOT want to
consolidate all of these into a single
solution. They like the separation of
applications across sites. I just dont
want to continue dealing with the
hassle of multiple updates for common
elements (which there will be many
more of across these applications).
The code is all stored in team
foundation server. We also do NOT want
to compile the master page into a dll
and deploy it.
You eliminated the only two real options there. What all is in the master page? Would it be possible to extract the HTML UI elements to a single template or series of template HTML files and import those dynamically into the master page? You could then relocate the common HTML to an arbitrary URL and have the master page for each application pull it in dynamically.
Edit: I lied. You could also use a VirtualPathProvider like Sharepoint does to store the master page in a database or some other directory, but beware that VirtualPathProviders do not work in MediumTrust environments.
See:
http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx
If you are using Web Applications (compiled into a dll) rather than Web Sites you can do the following:
Right click on the folder you want to store the master page in
Select "Add Existing Item..."
Browse to the master page on the file system, and select both the .master and the .master.cs files.
Then, rather than clicking on the "Add" button, click on the little down arrow to the right of Add, this will bring up a little menu with the options: "Add" and "Add As Link"
Select "Add As Link" this will reference the file in your project, while leaving it in the original location in your dev environment - this allows you to edit it in either application, while keeping it up to date in the other applications.
Obviously if you edit the code behind, you'll need to re-compile the other projects before you deploy the changes to those sites.
This isn't available in web site projects as they rely on the file structure to work out what is in the project.
EDIT: Missed the css part. Obviously you won't be able to serve those files, so this should only work for the master page.
Don't know your scenario, so
IF you can control the DNS / virtual directories to the applications you could use a format like this:
c:\inetpub\wwwroot\Application1
c:\inetpub\wwwroot\Application2
c:\inetpub\wwwroot\Application3
c:\inetpub\wwwroot\Application4
c:\inetpub\wwwroot\Application5
and have your Master page at c:\inetpub\wwwroot\master.Master,
c:\inetpub\wwwroot\master.Master.cs,
c:\inetpub\wwwroot\master.Master.cs.designer
Then you could reference the single copy of the master page from /../master.Master. I gave this a quick shot with a precompiled master page to make sure I could reach back beyond my root. You might have to give it a shot to see.
We use our source control to create links to the shared files in all the places that we need it. So if you edit in one place, you just need to do a get latest and it will appear in the other places you have linked it.
I ended up going with the VPP route. I created a virtual path provider and built my master page into a DLL and this is working. Now I have a massive problem though in that a Content page whos master page is late bound through the codebehind throws validation/formatting hissy fits because it thinks its should be a stand along page. my CNTRL + K, CNTRL + D has broken on every page where I'm now sharing my master page. This is extremely frustring for me and the team

Resources