Friday, April 16, 2010

“Client-only Framework subset” in Visual Studio 2008

The .NET Framework Client Profile setup contains just those assemblies and files in the .NET Framework that are typically used for client application scenarios. For example: it includes Windows Forms, WPF, and WCF. It does not include ASP.NET and those libraries and components used primarily for server scenarios. Approx. 26MB in size, and it can be downloaded and installed much quicker than the full .NET Framework setup package. For more info Click here

Thursday, April 8, 2010

SilverLight WebPart

To Develop Silverlight WebPart
1.Create a Silverlight Application first, compile it to get the .XAP file.
2.Create a WebPart project add the Silverlight .XAP file like this
Example

protected override void CreateChildControls()
{
//base.CreateChildControls();
System.Web.UI.SilverlightControls.Silverlight myMediaCtrl = new System.Web.UI.SilverlightControls.Silverlight();
myMediaCtrl.ID = "RajMediaPlayer";
myMediaCtrl.Source = "http://rajwss.com/rajss1/monkDocumentLib/RajMediaPlayer.xap";// media files can be uploaded to this same Document Library.
myMediaCtrl.Width = new System.Web.UI.WebControls.Unit(900);
myMediaCtrl.Height = new System.Web.UI.WebControls.Unit(650);

this.Controls.Add(myMediaCtrl);

}
3.Compile it and deploy to the server.
Server Side changes

1.Install Silverlight SDK on the Sharepoint Server.
The Silverlight SDK can be downloaded from : http://www.microsoft.com/downloads/details.aspx?FamilyID=8D933343-038F-499C-986C-C3C7E87A60B3&displaylang=en
After the SDK has been installed make sure the System.Web.Silverlight.dll assembly has been registered in the GAC.
i also installed Silverlight.exe(V 3.0) in the server(not required though)
2. Make the following changes to the SharePoint Site web.config file
Add the following to the configuration (copy to NotePad Replace lt; to < & gt; to > )

Add the following to the lt;configurationgt;lt;configSectionsgt; xml:

lt;sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"gt;
lt;sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"gt;
lt;section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"gt;
lt;section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /gt;
lt;section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /gt;
lt;/sectionGroupgt;
lt;/sectionGroupgt;
lt;/sectionGroupgt;

Add the following to the lt;configurationgt;lt;Sharepointgt;lt;SafeControlsgt; xml:

lt;SafeControl Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" /gt;
lt;SafeControl Assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.SilverlightControls" TypeName="*" Safe="True" /gt;

Add the following to the lt;configurationgt;lt;system.webgt;lt;httpHandlersgt; xml:

lt;remove verb="*" path="*.asmx" /gt;
lt;add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /gt;

Add the following to the lt;configurationgt;lt;system.webgt;lt;compilationgt;lt;assembliesgt; xml:

lt;add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /gt;
lt;add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /gt;
lt;add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /gt;
lt;add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;

Add the following to the lt;configurationgt;lt;system.webgt;lt;pagesgt; xml:

lt;controlsgt;
lt;add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;/controlsgt;

Add the following to the lt;configurationgt;lt;runtimegt;lt;assemblyBindinggt; xml:

lt;dependentAssemblygt;
lt;assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" /gt;
lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /gt;
lt;/dependentAssemblygt;
lt;dependentAssemblygt;
lt;assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" /gt;
lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /gt;
lt;/dependentAssemblygt;

Add the following to the lt;configurationgt; xml:

lt;system.webServergt;
lt;validation validateIntegratedModeConfiguration="false" /gt;
lt;modulesgt;
lt;remove name="ScriptModule" /gt;
lt;add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;/modulesgt;
lt;handlersgt;
lt;remove name="WebServiceHandlerFactory-Integrated" /gt;
lt;remove name="ScriptHandlerFactory" /gt;
lt;remove name="ScriptHandlerFactoryAppServices" /gt;
lt;remove name="ScriptResource" /gt;
lt;add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /gt;
lt;/handlersgt;
lt;securitygt;
lt;authorizationgt;
lt;add accessType="Allow" users="" /gt;
lt;add accessType="Allow" users="?" /gt;
lt;/authorizationgt;
lt;/securitygt;
lt;/system.webServergt;

3.To add the Silverlight XAP to the IIS MIME-Type complete the following steps:
Open IIS
Open up the properties for the IIS Web Server
Click MIME Types...
Click New...
Enter ".xap" for the Extension
Enter "application/x-silverlight-app" for the MIME type
Click Ok, Ok, Apply
4. Restart IIS.

5.Add the deployed WebPart to the page.

For the complete code check
http://www.vbforums.com/archive/index.php/t-557072.html

Saturday, March 13, 2010

XSL,XSLT,XSL-FO

The eXtensible Stylesheet Language(XSL) is divided into two sub-languages: eXtensible Stylesheet Language Transformations (XSLT) and eXtensible Stylesheet Language - Formatting Objects (XSL-FO).

XSLT documents are well-formed XML documents that describe how another XML document should be transformed. For XSLT to work, it needs an XML document to transform and an engine to make the transformation take place. In addition, parameters can be passed in to XSLTs providing further instructions on how to do the transformation.

1. XSLT - XSL Transformation
2. XPath - for selecting precise nodes
3. XSL-FO - XSL Formatting Objects

XSL-FO is more powerful. Normally for XML to XML or XML to HTML etc using templates XML or HTML format results are omitted. XSL-FO is used for generating WORD Documents, RTF Documents, PDF, txt, etc.

Commonly

Thursday, February 25, 2010

AJAX WCF Services with JSON and XML

Ajax WCF Service using GET /POST Method

The WebGetAttribute attribute is applied to the Add operation to ensure that the service responds to HTTP GET requests. The code uses GET for simplicity (you can construct an HTTP GET request from any Web browser). You can also use GET to enable caching. We can also add the WebInvokeAttribute attribute to explicitly specify HTTP POST, or not specify an attribute, which defaults to HTTP POST.
[ServiceContract(Namespace = "MyAjaxService")]
public interface ICal
{ [OperationContract]
[WebGet]
double Add(double x1, double x2); }

You can create an AJAX endpoint on the service by using the webHTTPBinding standard binding and the enableWebScript behavior in the service configuration file.
The enableWebScript behavior sets the default data format for the service to JSON instead of XML as shown below.
to change the Serializer
[OperationContract]
[WebInvoke(ResponseFormat=WebMessageFormat.Xml)]
//WebMessageFormat.JSon for Json Serializer
Public string HelloWCF()
{ Return “Hello WCF” }

For client follow any one of the technic
Add an ASP.NET AJAX Endpoint with out using Configuration
or
Use configuration to add an AJX Endpoint.

Tuesday, February 9, 2010

WSS Featues & it's Scope

A feature is like a site definition: a directory containing CAML-based XML files and page templates. The Feature is a container of various defined extensions for SharePoint.
Features provide the following capabilities:

  • Pluggable behavior for installing or uninstalling Features within a deployment.
  • Pluggable behavior for activating or deactivating Features at a given scope.

Features can be activated on an existing site. For example, we can create a feature that defines a custom list type, an instance of that list type, and an event handler or workflow on that list instance. Once the feature has been installed, it can be activated in any site within a farm and you can activate it through the WSS user interface, from the command line, or through custom code written against the WSS object model. Once the feature has been activated, the site will include the new custom list and any behavior we want to attach to it.
Location:
Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES

Scope & Accessibility

•
Site Scope
Only available for the root site of a site collection and is not displayed in the sub sites, Available only on the Site Collection Features page, accessible from the Site Actions menu.

•
Web Scope
Available on every web site including the root of the site collection

•
Web Application Scope
Available to all sites in all site collections of the web application and they can be activated and deactivated from Central Administration > Application Management > Manage Web Application Features.
•
Farm Scope
Available to all web application in the Farm level. Accessible from Central Administration > Operations > Managers Farm Features.