Microsoft SilverLight 0




Yüklə 31.64 Kb.
tarix27.02.2016
ölçüsü31.64 Kb.
Microsoft SilverLight 2.0

Overview:

Silverlight is a new Web presentation technology that is created to run on a variety of platforms. It enables the creation of rich, visually stunning and interactive experiences that can run everywhere: within browsers and on multiple devices and desktop operating systems.

Silverlight is not only an appealing canvas for displaying rich and interactive Web and media content to end users. It is also a powerful yet lightweight platform for developing portable, cross-platform, networked applications that integrate data and services from many sources. Furthermore, Silverlight enables you to build user interfaces that will significantly enhance the typical end user experience compared with traditional Web applications.

Silverlight enables you to create a state-of-the-art application that has the following features:



  • It is a cross-browser, cross-platform technology. It runs in all popular Web browsers, including Microsoft Internet Explorer (version 6.0 and 7.0), Mozilla Firefox, and on Microsoft Windows and Apple Mac OS X.

• It is lightweight browser plug-in.

  • It enables rendering of richer user experiences that are defined by XAML.

  • It enables programming that is consistent with the Web programming model.

• It streams video and audio.

• It includes compelling graphics that users can manipulate—drag, turn, and zoom—directly in the browser.

• It reads data and updates the display, but it doesn't interrupt the user by refreshing the whole page.

Content for a Web page that contains Silverlight elements can be created by using the following tactics:



  • Inline XAML and JavaScript.

  • External XAML files and JavaScript files.

  • Compressed content package that contains XAML, managed code, images, fonts, and media. Streaming media sources can be referenced from the XAML media elements.



Software Required:

Following software required for developing silverlight application:



  • Internet explorer 5.5 or above.

  • Visual Studio 2008 sp1.

URL: http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en.

  • SilverLight Developer “SDK- Silverlight.2.0_Developer.exe”.

URL: http://go.microsoft.com/fwlink/?LinkId=127693

  • Silverlight toolkit “Silverlight_Tools.exe”. (This will also install the Silverlight plug-in for Internet Explorer.)

URL: http://www.microsoft.com/downloads/details.aspx?FamilyId=c22d6a7b-546f-4407-8ef6-d60c8ee221ed&displaylang=en

Following software required for running silverlight application:



  • Internet explorer 5.5 or above.

  • SilverLight plug-in “Silverlight.2.0.exe”. (This will only install the Silverlight plug-in for Internet explorer.)

URL: http://go.microsoft.com/fwlink/?LinkID=124807

Installation Steps:

  • Install visual studio 2008.

  • Install patch (VS 2008 sp1) to update the visual studio 2008 to visual studio 2008 sp1. This patch will require 4GB free space only for running it.

  • Install the Silverlight toolkit. During installation if the VS2008 SP1 is not installed on machine then following errors screen has been displayed.

If the SilverLight toolkit fails (Asking for installing SilverLight developer kit) and the following message screen is coming then do the following steps:



  1. Open a command-line window and navigate to where you downloaded the silverlight_tools.exe. Run the following command:

silverlight_tools.exe /X

  1. This should bring up a window like this:

Choose a location where you want the installer files to be extracted.  Make note of that path.



  1. Now take the Silverlight.2.0_Developer.exe file you downloaded (Silverlight 2 Developer Runtime) and put it in the folder where you just extracted the tools bits.

  2. Now from the extracted folder, run SPInstaller.exe and the setup should run through installing the developer runtime and all the other required tools for development.

Configuration Steps:

Configure silverlight with Windows Server 2008 IIS 7.0:



  • All MIME types needed to support Silverlight are implemented by default in Windows Server 2008 & 2003 IIS 7.0 and Windows Vista SP1.  Windows Vista RTM customers can add mime types by running "IIS Manager", clicking on "Mime Types", then clicking "add" and adding the following mime types:

    1. .xap     application/x-silverlight-app

    2. .xaml    application/xaml+xml

    3. .xbap    application/x-ms-xbap

Configure silverlight with Windows Server 2008 IIS 6.0:



  • To enable IIS 6.0 in Windows Server 2003 or IIS7 in Windows Vista RTM with the appropriate MIME Types, add: 

  1. .xap     application/x-silverlight-app

  2. .xaml    application/xaml+xml

  3. .xbap    application/x-ms-xbap

1. Go to Start\Administrative Tools and run IIS Manager, see figure below:

2. Right click on the server name and select "Properties", see figure below:



3. In the Properties Dialog, click on the "MIME Types" button, see figure below:



4. In the "MIME Types" Dialog, click the "New" button, see figure below:



5. In the "MIME Type" Dialog enters one MIME Type at the time:



  1. .xap     application/x-silverlight-app

  2. .xaml    application/xaml+xml

  3. .xbap    application/x-ms-xbap

See figure below:



Creating a New Silverlight Application using VS 2008

Start silverlight application by selecting the File->New Project menu item within Visual Studio 2008 and use the New Project dialog to create a "Silverlight Application" (note: you will need to download and install the Silverlight Tools for VS 2008 release to get this support):



We'll name the project "Mysample".  When we click the "OK" button Visual Studio will prompt us with an additional dialog that allows us to choose whether we want to create just a Silverlight Application project, or optionally also add a server-side ASP.NET Web project to our solution to host the Silverlight Application within.  For this sample we'll choose to add an ASP.NET Web Application project to the solution as well and name it " Mysample _WebServer".  When we click "ok" Visual Studio will create a solution for us that have both a Silverlight client application and an ASP.NET web server application in it:



When we do a "build" Visual Studio will automatically copy the compiled Silverlight application to our web server project (no manual step or configuration required).  The default web server project that VS created for us contains both an ASP.NET page and a static HTML page that we can use to run and test our Silverlight Application within. 

By default a newly created Silverlight application project contains a Page.xaml and App.xaml file, as well as code behind class files (which can be written in VB, C#, Ruby or Python) that are associated with them:

XAML files are XML text files that can be used to declaratively specify the UI of a Silverlight or WPF application. XAML can also be used more broadly to declaratively represent .NET objects.

The App.xaml file is typically used to declare resources, such as brush and style objects that are shared across the application.  The Application code-behind class for the App.xaml file can be used to handle application level events - like Application_Startup, Application_Exit etc.

The Page.xaml file is by default the initial UI control that is loaded when the application activates. Within it we can use UI controls to define our user interface, and then handle events off of them within the Page code-behind class.

When we build our Mysample project, Visual Studio will by default compile the code and .XAML markup into a standard .NET assembly file, and then package it and any static resources (like images or static files we want to include in it) into a "Mysample.xap" file on disk: 

Sample Silverlight Application Code Details (using c#):

The newly created Silverlight application project contains a Page.xaml and App.xaml file, as well as code behind class files that are associated with them. The “Page.xaml” file is used for particular web page and “App.xaml” file is used to applied changes in the whole application.



In sample application only one page is needed so all the functionality is in “Page.xaml” file and related code is in the code behind class file of the “Page.xaml” file. This application does the following tasks:

  1. OnPageLoad the sends the request to the server page “time.asp” and get the response. This process is schedule for every 20 seconds i.e. every 20 seconds send the request to the “time.asp” and got the response from it. After sending 3 requests it again sends the request to same page after 70 seconds (for getting the Site-Minder custom response).

  2. After getting the response, retrieves the necessary headers (status, content-type…) from response and check the “content-type” header from the response headers, it’s check that whether the response is in xml format or is in html format.

  3. If the response is in html format then get the response body by parsing it through Xml Dom Parser. And if the response is in html format then get the response body by parsing it through reader object.

  4. After getting response body, checks that whether the response body contains custom siteminder response or its actual response by searching siteminder attributes (SiteminderReason, SiteminderRedirectURL) in the response body.

  5. If the response body contains the Siteminder attributes then it works according to that attributes i.e. if the value of attributes "SiteminderReason" = "challenge" and "SiteminderRedirectURL" = "" then redirect to the root URL else redirect to the URL that is present in the "SiteminderRedirectURL" attribute.

  6. If the response body doesn’t contain any siteminder attributes then this body is simply written into the textbox.

  7. If there is any exception occur during processing, redirect to the root.html page.

Silverlight files and its associated files are in the following zip file.

Steps to run Silverlight Application to test the Web 2.0 feature:

  1. Install the policy-server and do all the settings that are needed to protect the particular resource. After that add and change the parameter with the following parameter in the ACO parameter list:

WebAppClientCustomResponse.

Resource=/test/Time.asp|Method=GET|Status=200|Body=C:\Inetpub\wwwroot\output.txt|Content-type=text/html|Charset=us-ascii

  1. Install web-agent R12.5 with the web2.0 binaries.

  2. Publish the Silverlight application through VS-studio 2008 and then protect this application with form auth scheme. Also protect the “Time.asp” page using the form auth scheme.

  3. First access the Root page (Page containing the redirection link to the Silverlight application). This page is unprotected page.



  1. On clicking on the hyperlink, the credentials prompt arises, after filling the valid username and password the valid session has been created and Silverlight application start its processing.

Note: Session recreation will happen outside the Silverlight environment – in a plain browser environment.



  1. Silverlight application sends the request to “time.asp” page (This page is also protected) and get the response. Silverlight application sends first three requests with 20 seconds time interval and after that it send the request after 70 seconds time interval.

  2. If the response does not have SiteMinder attributes then the response with the necessary headers display in the textbox.

  3. If the response does have some SiteMinder attributes, but not RedirectURL and reason is “Challenge” then the Silverlight application redirect to the root page after displaying the necessary response headers, response body and custom response attributes. And come out from the Silverlight session.




  1. If the response has some SiteMinder attributes with RedirectURL then the Silverlight application redirect to the RedirectURL attribute and come out from the Silverlight session.



  1. Again on clicking on the hyperlink that is presents in the URLs the credentials prompt arises, after filling the valid username and password the valid session has been created and Silverlight application start its processing.




Samples


Under Web Server root document folder, create a folder with the name silverlight and publish the silverlight application in that folder.Copy the time.asp file in this folder.

Sample ACO Parameters (for Silverlight based application)
Parameter Name: WebAppClientResponse

Parameter Value: Resource=/silverlight/time.asp|Method=GET|Status=200|Body=C:\Inetpub\wwwroot\output.xml|Content-Type=text/xml

Resource=/silverlight/time.asp|Method=GET|Status=200|Body=C:\Inetpub\wwwroot\output.html|Content-Type=text/html


Parameter Name: MaxTimeoutURL

Parameter Value: http:// smdevesx1vm42.ca.com/maxtimeout.html
Parameter Name: IdleTimeoutURL

Parameter Value: http:// smdevesx1vm42.ca.com/maxtimeout.html
Parameter Name: OverlookSessionForUrls

Parameter Value: /silverlight/time.asp
Sample Pages



Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azrefs.org 2016
rəhbərliyinə müraciət

    Ana səhifə