Monday, December 14, 2009

Error 1 The “Validatexaml” task failed unexpectedly.System.IO.FileLoadException.Could not load file or assembly.

If you are facing the ValidateXaml exception and your build fails then it might be due to the new feature of blocking the downloaded content.

This means whenever you download a project from the internet it is quite likely that windows will automatically block its content for few dll’s and if it’s so you will get this error.

So the easy solution is to look for the file for which its complaining as in the above solution its the Activity control for which it’s complaining, so just navigate to that file right click on the file and press unblock and that’s it , go  and rebuild your solution and everything will work as desired.

I have myself faced this problem in Windows Server 2008 and Windows 7.

You might try this also in Windows Vista as well.Hope this helps.

Happy programming !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Wednesday, December 02, 2009

Silverlight 3 RIA Services :- Cannot resolve symbol web

If you are using RIA Services with Silverlight and facing the problem that Web part or the server part of the project is not getting recognized on the client side or the Silverlight side, then one probable and main cause is that you are using Resharper and if that’s the case then the below solution will help you tackle this problem.

Before applying this solution do check that RIA Services is installed on your machine because if its not installed then the cause of this problem would be RIA Services itself is not present on the machine.But if it’s installed and you are still facing the same problem then here goes the solution.

  • Just go to your solution and in the client project or the Silverlight project click on the “Show all files” icon

  • You will notice a Generated_Code folder inside the Silverlight project

  • Right click on the Generated_Code folder and select the include in project option

  • As soon as you include the Generated_Code folder in your project the problem you were facing will be removed.
  • This will also remove one other problem, if you use both Expression Blend and Visual Studio for the development then you might have observed if you have opened a file inside the visual studio and expression blend simultaneously if you build your solution in Visual Studio then it asks to overwrite files inside the generated_code folder, if you include this generated_code folder inside the project then this problem will also be removed.
  • One important thing to keep in mind is never try to modify files inside this folder as they are generated dynamically the above workaround is simply to solve issues that come across the development to quick and ease things.

Happy Programming !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thursday, November 26, 2009

Silverlight Toolkit November 2009 Released

Silverlight Toolkit is on a rapid pace from July to October and now again a release in November there are various improvements and other nice features which you will like.

You can download the Silverlight 3 Toolkit November 2009 from

http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36060#DownloadId=93512

And also the Silverlight 4 beta Toolkit November 2009 from

http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36060#DownloadId=93513

Stated below are the changelist from the October version of the toolkit.

RTL
  • All Toolkit/SDK control visuals and input handling to exhibit the correct behavior for right-to-left languages and cultures in Silverlight 4.
Mouse Wheel Support
  • Controls that support scrolling can now be scrolled using the mouse wheel in Silverlight 4
Support for Validation in Themes
  • All Toolkit controls now show validation UI out of the box when there are data input errors.
BusyIndicator
  • New BusyIndicator control in the Silverlight Toolkit to easily toggle UI to a busy state.
  • Based on David Poll's ActivityControl which is used in the RIA Services project template and samples.
DataForm
  • Added Content property that allows the form UI to be set directly, without having to specify data templates to improve experience in the designer.
Charting
  • Supports more flexible subclassing scenarios of core classes
  • Provides more helpful exception messages in limited scenarios
  • Updated default Chart template to respect Padding
  • Type of Chart.LegendItems collection items changed to object for flexibility
  • Converted Legend to a HeaderedItemsControl for consistency.
ISM
  • Removed ImplicitStyleManager from Silverlight 4 to phase it out now that implicit styles are supported in the platform.
  • Updated Themes (TwilightBlue, ShinyRed, etc.) to work with implicit styles.
System.ComponentModel.Composition.Packaging.Toolkit.dll
  • Adds PackageCatalog and a Package class which enables support for downloading secondary XAP’s and loading them into a MEF catalog.
Silverlight Unit Test Framework
  • The Silverlight Unit Test Framework (Microsoft.Silverlight.Testing.dll) and the Visual Studio unit test metadata for Silverlight are now installed alongside the Silverlight Toolkit binaries
  • Source ships inside the Infrastructure Zip installed with the MSI
Silverlight Development Infrastructure and Tools
  • Visual Studio project and item templates for Silverlight Test Applications
  • Silverlight 3 version supports Visual Studio 2008, Visual Web Developer 2008, Visual Studio 2010 Beta 2, and Visual Web Developer 2010 Express
  • Silverlight 4 verison supports Visual Studio 2010 Beta 2 and Visual Web Developer 2010 Express
  • Experimental Silverlight Code Coverage support: collect block-level coverage data when using the Silverlight Unit Test Framework on a machine with Visual Studio 2010 and Static Analysis Tools
  • Silverlight test automation support through Microsoft Build: easily include unit test execution inside the build process. Support for simple automation of Windows Internet Explorer, Firefox, and Chrome automation.
  • DefaultStyleTask for large control library projects

Wednesday, October 21, 2009

Silverlight Toolkit October 2009 Released

I am glad to announce that my favorite Silverlight Toolkit has a next release out for production use earlier release was in July 2009 and now its the October Release.

You can download this release at http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30514#DownloadId=88327

Change List includes

Visual Studio 2010 Support
  • All controls updated to provide a great design time experience in Visual Studio 2010
Charting
  • All classes now unsealed
  • ISeries interface introduced as base interface for all Series
  • Breaking change: StylePalette renamed Palette and type changed to IEnumerable<ResourceDictionary> from IEnumerable<Style>
  • LegendItemStyle introduced to provide easier customization of LegendItem
Drag & Drop
  • Drag & drop support added for common items controls such as ListBox, TreeView, DataGrid, and charting controls.
  • System.Windows.Controls.Data.Toolkit assembly added.
  • The System.Reactive assembly is now installed alongside other Silverlight Toolkit binaries.

Other Updates

Accordion
  • Themes updated to add support for this control
ChildWindow
  • Themes updated to add support for this control
DataForm
  • Themes updated to add support for this control
DataPager
  • Themes updated to add support for this control
DomainUpDown
  • Mouse wheel support added to change value
GlobalCalendar
  • Mouse wheel support added to navigate between months in year mode and years in decade mode
GridSplitter
  • Themes updated to add support for this control
TimePicker / TimeUpDown
  • Mouse wheel support added
TreeMap
  • VB Sample added

Monday, October 05, 2009

System.IO.FileNotFoundException Could not load file or assembly 'App_Web, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified

I recently faced this problem with one of my WCF services, i was unable to find the reason for this as it complains that it could not load an assembly which in my case never existed.So seeing the error i knew that it was not my fault but it was the fault of the framework itself.

What i know and what seemed to me is that this error occurs due to some invalid data in the temporary files which .net creates while running an application.Due to the differences in the code of the temporary files from the actual code this error arises.

Little help from Google suggested me that it’s a known issue and Microsoft has not yet found any fix for this situation although there are a few workarounds which you can do in order to escape from this problem.

In this article i will discuss those workarounds and remember there is no specific workaround so you have to test all whichever may suite you.

  • First of all just try this one and see if it works then its the easiest, just make a note of whichever control is causing trouble to you it could be your masterpage, you usercontrol or your web service or WCF service.Just go to that control or service and simply edit something, just deleting a small space or pressing an enter key and deleting some white spaces would do and save the document, what this will do is it will ask the runtime to regenerate the temporary file and the regenerated temporary file will be correct as earlier somehow the temporary file generated for this file was incorrect.So most of the times this would do the trick especially in case of services.
  • If the first solution doesn’t help you then you can go to c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files and delete all the files and force a complete recompile of the whole application.You have to be very careful in deleting the temporary files and don’t try this on the production server this tip is for those who know about the working of .net.If some files are locked then you can unlock them using “Unlocker
  • If the above 2 steps don’t work for you then add the batch= “false” compilation tag in your web.config

I think these three steps are sufficient to overcome this problem.

Moreover one thing which i want to add is that never directly start updating your production website with the new updates by just copying the new files on the production server, before copying just take the website down i.e pause the website and once your are done with your changes again put the website to go live or else you will run into this trouble every now and then.

If you have faced similar problems and you found some other solution or cause to this problem you can just share it here with smallworkarounds readers to help the community.

Happy Programming!!!!!!!!!!!!!!!!!!

Customizing Asp.net menu control to use jQuery,Superfish and CSS Friendly Control Adapters

I have used Asp.net menu controls in a lot of applications earlier but now a days with so many new things and controls asp.net menu control seems to lag in many basic functionalities, there are various other options available to be used as a replacement of the asp.net menu control.

But what i loved with the asp.net menu control was its seamless integration with the sitemap datasource and with no hassle i could display whole of my site’s navigation in the menu control by just configuring them in the sitemap file.

What i disliked most was that the menu control by default is rendered as a table structure and not as div structure.

So to fight this abnormality Microsoft released CSS Friendly Control Adapters so that most of the controls which are rendered as tables can be rendered as a simple and clean div structure.

But today i was experimenting with other available options and i found a really cool Superfish jQuery plug-in which we can attach with the asp.net menu control to achieve very cool affects.

In this article i will share the steps on how to hook up the Superfish jQuery Menu plug-in into your asp.net website to beautify your asp.net menu control.

Also please check various option available with the Superfish plug-in on how it can be customized from the Superfish plug-in website.

http://users.tpg.com.au/j_birch/plugins/superfish/#examples

Now let’s look at the steps to integrate superfish menu with asp.net menu

Main JavaScript file which is required is superfish.js along with jQuery any version.js rest files are optional and are used if we use some advanced features and customizations with the superfish menu.

Main CSS file is superfish.css and for this demo we will modify this file only.

  • After downloading the superfish menu files now we should download the CSS Friendly Adapter from http://cssfriendly.codeplex.com/
  • Place the CSSFriendly.dll into your website bin folder and the CSSFriendlyAdapters.browser in your App_Browser folder.Also remember to comment out the unwanted code from the CSSFriendlyAdapters.browser file as we are dealing only with the menu.
 <controlAdapters>
      <adapter controlType="System.Web.UI.WebControls.Menu"
               adapterType="CSSFriendly.MenuAdapter" />
      <!--adapter controlType="System.Web.UI.WebControls.TreeView"
               adapterType="CSSFriendly.TreeViewAdapter" />
      <adapter controlType="System.Web.UI.WebControls.DetailsView"
               adapterType="CSSFriendly.DetailsViewAdapter" />
      <adapter controlType="System.Web.UI.WebControls.FormView"
               adapterType="CSSFriendly.FormViewAdapter" />
      <adapter controlType="System.Web.UI.WebControls.DataList"
               adapterType="CSSFriendly.DataListAdapter" />
      <adapter controlType="System.Web.UI.WebControls.GridView"
               adapterType="CSSFriendly.GridViewAdapter" />
      <adapter controlType="System.Web.UI.WebControls.ChangePassword"
               adapterType="CSSFriendly.ChangePasswordAdapter" />
      <adapter controlType="System.Web.UI.WebControls.Login"
               adapterType="CSSFriendly.LoginAdapter" />
      <adapter controlType="System.Web.UI.WebControls.LoginStatus"
               adapterType="CSSFriendly.LoginStatusAdapter" />
      <adapter controlType="System.Web.UI.WebControls.CreateUserWizard"
               adapterType="CSSFriendly.CreateUserWizardAdapter" />
      <adapter controlType="System.Web.UI.WebControls.PasswordRecovery"
               adapterType="CSSFriendly.PasswordRecoveryAdapter" /-->
    </controlAdapters>

 

  • Also download the latest version of jQuery, otherwise there is already a version of jQuery in the Superfish package.
  • Now start creating your pages and once you are done , just create a sitemap file to list your whole website.
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="" title=""  description="">
        <siteMapNode url="Default.aspx" title="Home" description=""/>
        <siteMapNode url="AboutUs.aspx" title="About Us"  description="" />
        <siteMapNode url="Services.aspx" title="Services"  description="" >
            <siteMapNode url="Services/Service1.aspx" title="Service1" description="">
                <siteMapNode url="Services/SubService1.aspx" title="SubService1" description="" />
                <siteMapNode url="Services/SubService2.aspx" title="SubService2" description="" />
                <siteMapNode url="Services/SubService3.aspx" title="SubService3" description="" />
                <siteMapNode url="Services/SubService4.aspx" title="SubService4" description="" />
            </siteMapNode>
            <siteMapNode url="Services/Service2.aspx" title="Service2" description=""/>
            <siteMapNode url="Services/Service3.aspx" title="Service3" description=""/>
            <siteMapNode url="Services/Service4.aspx" title="Service4" description=""/>
        </siteMapNode>
        <siteMapNode url="ContactUs.aspx" title="Contact Us" description=""/>
    </siteMapNode>
</siteMap>
  • After building all this your solution architecture should be like this.

  • Now just the master page configuration is left and you are ready to go then
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Default.master.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="Scripts/jquery-1.3.1.js" type="text/javascript"></script>

    <script type="text/javascript" src="Scripts/superfish.js"></script>

    <link type="text/css" href="~/Styles/superfish.css" rel="stylesheet" media="screen"
        runat="server" />
    <link href="Styles/stylemain.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        $(document).ready(function() {
            $('ul.AspNet-Menu').superfish();
        }); 
    </script>

    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div id="outerWrapper">
        <div id="header">
            <div id="logo">
                <asp:HyperLink runat="server" NavigateUrl="~/Default.aspx" ID="lnkLogo">    
                </asp:HyperLink>
            </div>
        </div>
        <div id="menu">
            <asp:Menu ID="menuMain" runat="server" DataSourceID="stmpDataSource" Orientation="Horizontal">
            </asp:Menu>
            <asp:SiteMapDataSource ID="stmpDataSource" runat="server" ShowStartingNode="false" />
        </div>
        <div id="mainContent">
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            </asp:ContentPlaceHolder>
        </div>
        <div id="footer">
        </div>
    </div>
    </form>
</body>
</html>
  • Important :- By default the Superfish menu css file contains the settings aligned with the ul name sf-menu but the asp.net menu control renders the ul element as AspNet-menu so the important step is to replace all the occurrences of sf-menu in the superfish.css with AspNet-menu to make this menu work.

        You can download the sample project and plug and play with the CSS file customized for the asp.net menu if you find difficulties in customizing by your self.

        After embedding this in your master page you are done with the settings and customization and you are ready to go, i got this menu in just 15 minutes so simple and so easy.

        Working Demo can be seen here http://www.smallworkarounds.com/demos/superfish.demo/

        Download the Demo from http://www.smallworkarounds.com/blog/democode/Superfish/Superfish.Demo.zip

        Happy Programming!!!!!!!!!!!!!!!!!!!!

        Thursday, September 24, 2009

        Microsoft supporting web startups and independent web developers by providing free software's for 3years

        Microsoft has launched today a very exciting program called WebSiteSpark for individual developers and small web startup companies having less than 10 employees.

        Given below are few software licenses which will be given free to you for 3 years

        • 3 licenses of Visual Studio 2008 Professional Edition
        • 1 license of Expression Studio 3 (which includes Expression Blend, Sketchflow, and Web)
        • 2 licenses of Expression Web 3
        • 4 processor licenses of Windows Web Server 2008 R2
        • 4 processor licenses of SQL Server 2008 Web Edition
        • DotNetPanel control panel (enabling easy remote/hosted management of your servers)

        IMHO it is very good initiative by Microsoft to promote small companies and individuals to leverage their products and build next generation application on the web.

        More information can be found here

        http://weblogs.asp.net/scottgu/archive/2009/09/24/announcing-the-websitespark-program.aspx

        http://www.microsoft.com/web/WebSiteSpark

        Monday, September 14, 2009

        Saving Changes is not permitted.The changes you have made require the following tables to be dropped and recreated..Sql Server 2008 Management Studio Express Error

        If you have just installed Sql Server 2008 Express Edition and you have your default settings then you probably might get this error when your want to change some table and then save changes.

        In the default settings “Prevent Saving changes that require table recreation” is checked which prevents to save the changes which you make in the design of the table.

        So in this article i will talk less and give you a walkthrough on how to remove this ugly error and to keep it explanatory i will use images rather then simple text.

        So the error looks like this

         

        Now the stepwise solution is :-

        1. Click Cancel on this screen and then click OK on the next screen.
        2. On the top menu bar select the Tools option and inside tools select the Options menuitem.

         

         

          3.Inside options select the “Designer” and in the designer context form “uncheck” the option which says “Prevent Saving changes which requires recreation”.

          4.Click OK and you are done and now save changes to your table and your error should no vanish.

        Happy Programming!!!!!!!!!!!!

        Thursday, September 10, 2009

        Unable to connect to Sql Server 2008 Express Edition Remotely using the IP and the named instance

        If you are trying to connect your sql server 2008 express edition instance remotely and facing problems while connecting it although you have tried all the possible solutions in the book then the problem can be a really very silly thing and what’s that thing , i will describe it shortly. If you are getting the below mentioned error then there might be many reasons for that error.

        A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (.Net SqlClient Data Provider)

        So in the list of probable reasons is :-

        • Check if the sql server 2008 express edition service and sql server browser services are running or not, if not then please run them first.

        • First check whether TCP/IP is enabled in the Sql Server Configuration Manager Tool and select the instance of sql server 2008 express edition for that, if not enabled enable it.

        • If TCP/IP is enabled then check your firewall settings open two ports 1433 and 1434 on the firewall, generally 1433 is meant for Sql server and 1434 is meant for sql server browser. 1433 is TCP port and 1434 is UDP port
        • The silly mistake which happens when working with sql server 2008 express edition is that by default it runs on dynamic ports so you can’t run it remotely with all the above configuration and it will lead to frustration.So what to do then, the solution is just go to properties of the TCP/IP and in the TCP Port just give whatever port you want your sql server to be run on.That will do the trick for you.

         

        • After doing the port settings now check the firewall rules and open the respective ports which you have just configured and your sql server instance will run remotely.

        Happy Programming!!!!!!!!!!!!!!!!!!!!

        Thursday, September 03, 2009

        Adding Google Friend Connect to Blogengine.net Blog

        Today i am shifting my blog from BlogSpot to custom domain, so i will be doing a series of post in all the hassles i have to face during this exercise and share my experience with you, so that any one else in plans of shifting the blog to custom domain and also the blog code being open source, should not face the same problems as i am facing.

        Smallworkarounds was known for its unique look and feel and various plugins customized in the heart of Google’s blogger.Still the new blog is not even close to the look and feel of the current BlogSpot version but its OK for now i will be rewriting the whole code myself within few days as i get time from my busy schedule.

        I will be writing mostly on how to transfer each module you see on Smallworkarounds on blogspot to www.smallworkarounds.com.

        For today i will be discussing how to integrate Google’s Friend Connect into BlogEngine.net.

        First of all let me tell you why i chose blogengine.net, the obvious reason is that i have already worked on blogengine.net and i am familier with most of its code and I can do tweaks to it’s code in no time.

        Secondly what i found after googling was that blogengine.net is the leader in the open source blog engines built in .net. Although there are few other competitors but again all comes to personal choice you can use anyone of the other products out there.

        I faced few issues with blogengine.net on Godaddy but i will be dealing those issues in the upcoming posts.

        So let’s begin the journey from what i am currently doing and leave the  rest for future.

        Currently i have all my posts imported from blogger to blogengine.net  with some minor errors which i am tweaking daily.

        In my blogspot blog i was having a Google Friend Connect toolbar which used to pop up at the bottom, but now the question is how to get the same popup bar with same followers in your blogengine.net blog with your custom domain.

        Googling a bit lead me to this post by Mayank Raichura , he has done all the hard work but what he has implemented is a little different from what i wanted.

        You can download his sample from here

        Hi implementation lets you to have google friend connect only inside the posts pages not on all the pages as this is clear from his code i modified his code a bit and everything then worked just fine for me.

         public void CreateFriendConnectBar(ServingEventArgs e)
            {
                settings = ExtensionManager.GetSettings(GetType().Name);
        
                //Settings should be retrieved after this...
                string sb_Site_ID = settings.GetSingleValue("Site_ID").ToLower();
                string sb_Div_Tag_ID = settings.GetSingleValue("Div_Tag_ID").ToLower();
                string sb_Scope_of_Social_Bar = "SITE";        
                bool sb_Allow_Anonymous_Post = bool.Parse(settings.GetSingleValue("Allow_Anonymous_Post").ToLower());
        
                //End Settings Retrieval
                e.Body += "\n<!-- Google_Friend_Connects_Social_Bar extension by Mayank Raichura -->\n";
                e.Body += BuildHTML(sb_Site_ID, sb_Div_Tag_ID, sb_Scope_of_Social_Bar, sb_Allow_Anonymous_Post);
            }
            private void Post_Serving(object sender, ServingEventArgs e)
            {
                post = (Post)sender;
                CreateFriendConnectBar(e);
            }

        I removed his code where he is checking whether it is a post page or stuffs related to posts which he is checking in his first few lines and created a method called CreateFriendConnectBar(ServingEventArgs e) which i call from the Post_Serving event basically i am not checking that is the post null or something else, this will run in every case.

        The important thing which you have to do other then what is stated is instead of this line

        string sb_Scope_of_Social_Bar = "PAGE";

         

        just replace “PAGE” with “SITE”, then just follow the instruction given on his blog to complete the steps.

        string sb_Scope_of_Social_Bar = "SITE";

         

        One more thing which most of you will forget is that consider a situation wherein from your previous blogspot blog your were having 2000 followers then you definitely would not want to lose your followers by just going and creating a absolutely new account for the new domain hosting.

        So the solution for this is just go to your Google Friend Connect account and remap the url or site url field to your new website on the custom domain.

         

         

         

         

        Also as a quick tip make sure your are having rpc_relay  and canvas files in your website root folder.

        Wednesday, August 26, 2009

        Text not scaling properly during animation in Silverlight

        If you are facing the problem where you text is not scaling properly and the animation is not coming smooth then in this kind of situation you have to use something which can find the nearest neighbor and convert the values in accordance with this nearest neighbor.

        If you are using Silverlight then you can do this very easily by typing just one line of code.

        For Silverlight 2 you have to type

        RenderOptions.TextRenderingMode = “RenderForAnimation”

        For Silverlight 3 you have to type

        TextOptions.TextHintingMode = "Animation"

        Both of these ensure that the text animation is proper, if you don’t use these properties then you will find sometime when you are applying some scaling or any other rendering transformation on any container which also contains some text element then this text element inside the container will also scale.

        I will give main emphasis on Silverlight 3 property i.e TextOptions.TextHintingMode

        This property takes one of two possible values: Animated or Fixed.

        “Animated optimizes for animation by using a more efficient, but less visually precise, smoothing algorithm. Text is still readable and the loss of precision is not that severe.”

        Fixed uses an algorithm that is optimized for visually precise text smoothing, but can lead to performance issues. For example, when animations are applied to properties of a text element, in particular FontSize, you might see jitters. When transforms, positioning, or projections are applied to text elements, you might see performance issues. Fixed is the default.

        You can apply this property to a layout container and the setting will apply to any text element within that container. However, in general, you should apply this property directly to a text element, such as a TextBlock, TextBox, or Glyphs, where the animations applied will only affect the text.

        Happy Programming!!!!!!!!!!!!!!!

        Monday, August 24, 2009

        Deleting User Alerts in Sharepoint (MOSS 2007)

        Setting alerts in MOSS 2007 is very easy just go to any list or library right click on Actions Tab and the last option available is the Alert Me feature. Configuring these alerts is very simple and is a child’s play but customizing the alert emails which are sent and sending list specific email alerts and stuffs like this are little bit tricky.

        Don’t worry here we are not discussing those horrifying issues but here we are simply going to discuss on how to delete the alerts which user has set on a particular list. There is a very simple process to do this you don’t need to write code for that but i am sharing this with you as for the novice programmer it’s a tedious task to find actually where to go to delete these alerts.

        • Just go to “Site Actions” on the top right corner of your sharepoint site and then click “Site Settings”.

         

        • Now look for the Site Administration section under that look for the User Alerts.

         

         

        • Once the User Alerts page is opened select a user for which you want to delete the alert, as you select the username from the dropdown list then all the alerts related to that user will be displayed.
        • Now you can select single or multiple alerts and click on the “Delete Selected Alert” link to delete the selected alert.

        Stay tuned for more articles on Sharepoint (MOSS 2007)

        Happy Programming!!!!!!!!!!!!!!!!!!!

        Thursday, August 20, 2009

        Finding and changing the default timer interval for timer jobs in Sharepoint

        Many times we need to change the default timer settings either by increasing the default time or by decreasing the default time of the timer jobs for a particular sharepoint site.

        Particularly if you want to send an email as soon as an action is performed within the sharepoint, in such a scenario you will need to decrease the default timing of the timer job.

        There are two commands by which you can achieve this very easily:-

        1. Finding the default time of the timer job, the delay in sending mails could be due to the default timing of the timer jobs which is by default 5 minutes.
        2. Decreasing the default time of the timer job to 1 minute.

        That’s all you need to do to adjust the default timer job timing delays.

        Happy Programming!!!!!!!!!!!!!!!!!

        Wednesday, August 19, 2009

        Smallworkarounds on Mobile

        Hi readers, i am pleased to announce that Smallworkarounds has been launched for the mobile platform using Mobify.Me service.

        You can find the mobile version of Smallworkarounds at www.smallworkarounds.mobify.me

        Now you can view your favourite new articles on your mobile set.There will be few more upgrades in future for this mobile site.

        I came across mobify.me through Woork and as soon as i used it, i started liking this service.

        I highly recommend you to go through this article on Woork to follow the steps to mobify your website.

        Saturday, August 15, 2009

        O3D:- Google Releases 3D support open api for web browsers

        O3D is an open-source web API for creating rich, interactive 3D applications in the browser. This API is shared at an early stage as part of a conversation with the broader developer community about establishing an open web standard for 3D graphics.

        The latest release is  O3D Release 0.1.40.1

        O3D is available in Internet Explorer, Firefox, Chrome, and Safari and works on any Linux, Mac, and Windows computer that meets the minimum hardware requirements.

        You can watch the sample here http://o3d.googlecode.com/svn/trunk/samples/beachdemo/beachdemo.html

        You can download O3D from http://code.google.com/apis/o3d/

        MOSS 2007 :- Editing a user profile

        There are times when you need to edit the user profiles and relate some meaningful data other then the default data which the user brings from its active directory or standalone profile.

        For this task you need to know where exactly you can modify the user profile.

        This article will tell you one possible way of modifying the user profile and relating an email address to the user.

        1.Open the Central Administration and from the central administration select the Shared Service Provider link.

         

        2.In the shared service provider open the User Profiles and properties link.

        3.After clicking the User Profile link you will be redirected to a page where you will find profile and import settings.On this page click on the view user profiles link, clicking on this link will take you to a page where you will find all the details related to the user, you can edit and save changes inside many of the given user related properties.

        4. View User Profile will redirect you to a page where you can find all the users now you can click on any of them and as soon as you click the dropdown around them you will find options saying Edit,Delete and Manage Personal Site, now just click on Edit link to start editing the user profile.

        5.Now a detailed screen will be opened for you where you can edit any of the properties among several properties which are there.You can associate work phone,title,office,department, email and many other attributes to the selected user which we are editing.

         

        6.After making all your changes, just click on the Save and Close button at the top of the Information to save your changes.

        And that’s all what you need to change the user’s profile, this is one of the method to reach here there can of course be other ways to reach at the same section, i would love to know about some other ways by which you people are manipulating the user profiles.

        Happy Programming!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        Friday, August 07, 2009

        Can't Uninstall SQL Server 2005 Express Tools:- Error while installing Sql Server Management Studio Express 2008

        The SQL Server 2005 Express Tools are installed. To continue, remove the SQL Server 2005 Express Tools.

        If you are getting the above error while installing Sql Server Management Studio 2008 then probably you might try the below given solutions one by one to fix this error.

        I m not certain what will work for you but i have added all the options which i found after spending some time on the net which various people have given and for me the most common one worked which also i have listed below.

        1. Rename the key “HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\90”. This worked for me i renamed the whole folder to “old” and then the installation started passing all the test. For x64 Windows Server 2008, the reg key needed is: “HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\90” ( Thanks to adam).

        Once Sql server Management Studio is installed successfully, then restart your system sql server installation will automatically ask you for a restart.

        After restarting you will see that your sql server 2005 instance will stop working because you played with the 90 directory and if you try to rename old to 90 then the system will not allow you to do so as it already created an entry name 90 for you having “Tools” and “Shell”.

        So now we are in deep trouble what to do next, what i did was i again renamed the 90 entry which it created to 70 and the entry for sql server 2005 which we renamed as old, again back to 90 and voila everything works fine now.

        Both sql server installations are running side by side and both management studios are also running side by side anyways we can open old database in SSMS 2008 so there is no need to have SSMS 2005 unless and until there is some special requirement.

        This was the hit and trial method and it worked for me for the first time but i would not suggest this method to be done on any full fledged install although you may test this on your virtual pc or vmware installation as it might corrupt your sql server 2005 installation in some cases.

        2.Try uninstalling any redgate products if you have installed any especially Red Gate Sql Prompt, this also caused issues to some users.

        3.Try uninstalling sql server Management Studio 2005 before installing SSMS 2008

        Above listed three ways will do the task for you, if you have resolved the problem in some other easy and concrete way then please do post your comment.

        Happy Programming!!!!!!!!!!!!!!

        Friday, July 31, 2009

        Renaming MOSS 2007 or Sharepoint Server

        Many times there are situations when you have to rename a MOSS installation either in your virtual PC environment and also sometimes in production, although the production one is little uncommon but the point is a sharepoint developer at one point or other want’s to rename his sharepoint server.

        Renaming the server simply will screw up all the settings inside the sharepoint as many places there are hardcoded references to the previous server which has to be remapped in order to run the MOSS server with the new server name.

        Here in this article i will explain you the step by step process for renaming the MOSS server.There are few resources available on the net which helps you in achieving the same but it was hard for me to find a good resource, so i thought to pen it down so that it can help everyone using Sharepoint.

        Steps:-

        1. Change Alternate Access Mappings
        2. Run stsadm for renaming the server.
        3. Rename the server physically on windows explorer.
        4. Reboot the server
        5. Update login credentials 
        6. Restart IIS
        7. Change identity references in IIS
        8. Reconfigure search index

        1.Change Alternate Access Mappings

        This is the first and foremost step to rename the Sharepoint server.Alternate access mappings can be found at Central Administration>Operations>Alternate Access Mappings

        Click on the web application url and edit the url to have the new server name.This you have to do manually for every website.

         

        2.Run stsadm for renaming the server.

        You have to rename the server using stsadm before actually or physically renaming the sharepoint server.

        The command to rename the server is

        stsadm –o renameserver –newservername “[yournewservername]”   -oldservername “[youroldservername]“ ” and this is also shown in the figure below:-

        stsadm can be found in “C:\ProgramFiles\Common Files\Microsoft Shared\web server extensions\12\bin\

        Developers can set the path to be globally accessible for ease of using stsadm instead of navigating to the whole path.How to configure environment variables in order to get the stsadm available globally can be found here :- http://smallworkarounds.blogspot.com/2009/07/sharepoint-quick-tip-add-stsadmexe-to.html

        3.Rename the server physically in the windows explorer

        For this step just right click on the My Computer icon in the start menu and click on properties then on the Computer Name tab just click Change button and rename it to whatever new name you want to give to your sharepoint server installation.

        4.Reboot the server

        After following all the 3 steps mentioned above just reboot your sharepoint server.

        5.Update Login Credentials

        Updating credentials is must as sharepoint server is still mapped to the old username inside the domain and will thus cause problems.To update credentials we will again use stsadm.exe

        stsadm –o updatefarmcredentials –userlogin “newservername\username” –password “yourpassword”

         

        6.Restart IIS

        IIS needs to be restarted in order to reflect the changes which we have just made in the above steps.

        Remember to restart the IIS using iisreset/noforce from the command prompt.

        7.Changing Identity references in IIS

        After doing all these changes still sharepoint website’s application pools are mapped to the old username and servername which were used to install the Sharepoint inside the farm.So in order to get rid of this old server name we have to manually change the Identity references in the IIS.

        Remember if the identity says “Predefined” and the value is set to Network Service then there is no need to play and touch those settings, let them be like that only.

         

         

        But if the Identity is configurable then you have to replace the old servername with the new servername in the username section and if you want to change the password then you have to type the password and retype it to confirm and press ok

        After this step almost everything is done you just have to configure search index to function properly.

        8.Reconfigure Search Index

        After renaming the sharepoint server the search index have to be reconfigured the best possible solution is to drop the search index and rebuild it.

        After doing all these changes you may still find at some places where few links are referencing your old server name and clicking those links does nothing more then giving a blank page to user saying nothing exists on the server like that which he is asking for.

        In such scenarios you have to use your hit and trial method and have to find the root element which is causing this trouble and definitely that would be configurable just you have to figure out which is the right spot to configure this.

        After doing this you might face problems with MySite which can be fixed once editing the People & Groups section of the MySite administration.

        At last you can navigate through various pages to check that whether your MOSS 2007 server is working or not.

        Disclaimer :- This article is based on my testing under my virtual environment things may vary and i advice not to test and play with your production farm sharepoint installations as this might damage your sharepoint server.

        Happy Programming !!!!!!!!!!!!!!!!!!

        Tuesday, July 28, 2009

        Sending List of Complex objects to Sql server 2005 and persisting it in the database

        There are situations when you have to do multiple inserts on a single event there are multiple ways to handle this situation.The simplest and which most of the developers do and make a blunder is making individual calls to the database.

        One common example can be a grid which have facility of multiple Insert in such a situation on a single add button click you have to make hundreds of insert or even thousands,there are more genuine scenarios such as, suppose you are making a Silverlight CMS system and you have to save the state of the page containing various sections such as Header,MenuBar,MainContent and Footer which have all the things customizable, in such a scenario you have to save hundreds of settings on a single save button click and you again have to show the user his settings when he again loads the website.

        For such situations involving hundreds or thousands of db inserts and updates making individual calls over the network is not at all good,instead i will say that its the worst approach.

        There are other approaches,most common of them is sending a list of comma separated values.Ideally this can be said to be a workaround if you are sending just an array or a list of one or two field objects.But for complex objects its the worst solution which i have ever seen and this solution very well persist over the internet.

        But its has various disadvantages first one is that there is complex string manipulation associated with this approach,you will be sending something like this “5,6,9,8,45,78,5,6” and then splitting this string on the comma’s(,).Another disadvantage is that this approach is sql injection prone and above all string manipulation is never considered a good design paradigm.

        So here in this article i will discuss about the way which i think is the best way to persist changes to the database in such a situation.

        We will be making use of xml support of the sql server 2005 and xml serialization of objects in C# to achieve our goal.

        Example Description:-This example is an application in Silverlight 2.0 with WCF,Linq,

        [Serializable]
            [DataContract]
            public class WebsiteContainer
            {
                [DataMember]
                public int WebsiteContainerID { get; set; }
        
                [DataMember]
                public int UserID { get; set; }
                [DataMember]
                public double LogoHeight { get; set; }
                [DataMember]
                public double LogoWidth { get; set; }
                [DataMember]
                public double LogoTop { get; set; }
                [DataMember]
                public double LogoLeft { get; set; }
                [DataMember]
                public string LogoFileName { get; set; }
                [DataMember]
                public string BgColor { get; set; }
                [DataMember]
                public string Text { get; set; }
                [DataMember]
                public double TextFontSize { get; set; }
                [DataMember]
                public string TextFontFamily { get; set; }
                [DataMember]
                public double TextLeft { get; set; }
                [DataMember]
                public double TextTop { get; set; }
                [DataMember]
                public string TextColor { get; set; }
                [DataMember]
                public double TextScale { get; set; }
                [DataMember]
                public double Padding { get; set; }
                [DataMember]
                public int ContainerTypeID { get; set; }
                [DataMember]
                public int WebsiteID { get; set; }
                [DataMember]
                public double ContainerHeight { get; set; }
                [DataMember]
                public double ContainerWidth { get; set; }
        
            }

         Its important to note that you have to place a serializable attribute on top of the class declaration so that this class’s object can be serialized to XML while sending it to Sql server.

        Now the second step is to write the C# code to serialize this object to XML to transmit over the network.

          public static string SerializeObject<T>(List<T> objects)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (var obj in objects)
                    {
                        try
                        {
                            XmlWriterSettings writerSettings = new XmlWriterSettings();
                            writerSettings.OmitXmlDeclaration = true;
                            writerSettings.Indent = true;
                            
                            using (XmlWriter xmlWriter = XmlWriter.Create(sb, writerSettings))
                            {
                                XmlSerializer xs = new XmlSerializer(typeof(T));
                                XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
                                ns.Add(String.Empty, String.Empty);
                                xs.Serialize(xmlWriter, obj, ns);
                            }
                        }
                        catch
                        {
                            return string.Empty;
                        }
                    }
                    return sb.ToString();
                }

        Above function will take a list of type T and then iterate through each object inside the list and serialize the object and append the serialized object string to a stringbuilder ‘sb’

        Here i would like to mention the real thing which you might miss is that , by default the writer settings are set to bring namespaces and xml dtd information which will result in error saying “XML parsing: line 1, character 841, text/xmldecl not at the beginning of input

        To rectify this error you have to add the writerSetting.OmitXmlDeclaration = true and also add empty namespaces using the XmlSerializerNamespaces this will give you a clean xml which can be parsed by the sql server 2005

        Finally we return the string builder object after converting it to string.

        After this step we have a serialized string of the whole list of objects as shown in given figure

        Now the next step is to get this xml serialized object list into the stored proc.Given below is the code on how can you retrieve this list in sql server 2005

        Create PROCEDURE [dbo].[SaveWebsite]
        @WebsiteContainerXML XML
        
        AS
        BEGIN
        DECLARE @WebsiteID INT
        
        	SET NOCOUNT ON;
        	
        SET @WebsiteID = (SELECT TOP 1 WebsiteContainerValues.ID.value('.','INT') FROM @WebsiteContainerXML.nodes('/WebsiteContainer/WebsiteID') as WebsiteContainerValues(ID) )
        
        		BEGIN TRANSACTION
        		DELETE FROM dbo.WebsiteContainer WHERE WebsiteID = @WebsiteID	
        		IF @@ERROR <> 0
         BEGIN
            ROLLBACK
            RAISERROR ('Error deleting records', 16, 1)
            RETURN
         END
        		INSERT INTO dbo.WebsiteContainer (
        			UserID,
        			LogoHeight,
        			LogoWidth,
        			LogoTop,
        			LogoLeft,
        			LogoFileName,
        			BgColor,
        			[Text],
        			TextFontSize,
        			TextFontFamily,
        			TextTop,
        			TextLeft,
        			TextColor,
        			TextScale,
        			Padding,
        			ContainerTypeID,
        			WebsiteID,
        			ContainerHeight,
        			ContainerWidth,
        			IsRightAligned
        			
        		) 
        		SELECT 
        				WebsiteContainerTab.WebsiteContainerCol.value('UserID[1]','int') AS UserID,
                        WebsiteContainerTab.WebsiteContainerCol.value('LogoHeight[1]','float') AS LogoHeight,  
                        WebsiteContainerTab.WebsiteContainerCol.value('LogoWidth[1]','float') AS LogoWidth,  
                        WebsiteContainerTab.WebsiteContainerCol.value('LogoTop[1]','float') AS LogoTop,  
                        WebsiteContainerTab.WebsiteContainerCol.value('LogoLeft[1]','float') AS LogoLeft,  
                        WebsiteContainerTab.WebsiteContainerCol.value('LogoFileName[1]','varchar(50)') AS LogoFileName,  
                        WebsiteContainerTab.WebsiteContainerCol.value('BgColor[1]','varchar(50)') AS BgColor,  
                        WebsiteContainerTab.WebsiteContainerCol.value('Text[1]','varchar(50)') AS TEXT,  
                        WebsiteContainerTab.WebsiteContainerCol.value('TextFontSize[1]','float') AS TextFontSize,  
                        WebsiteContainerTab.WebsiteContainerCol.value('TextFontFamily[1]','varchar(50)') AS TextFontFamily,  
                        WebsiteContainerTab.WebsiteContainerCol.value('TextTop[1]','float') AS TextTop,  
                        WebsiteContainerTab.WebsiteContainerCol.value('TextLeft[1]','float') AS TextLeft,  
        				WebsiteContainerTab.WebsiteContainerCol.value('TextColor[1]','varchar(50)') AS TextColor,  
        				WebsiteContainerTab.WebsiteContainerCol.value('TextScale[1]','float') AS TextScale,  
        				WebsiteContainerTab.WebsiteContainerCol.value('Padding[1]','float') AS Padding,
        				WebsiteContainerTab.WebsiteContainerCol.value('ContainerTypeID[1]','int') AS ContainerTypeID,  
        				WebsiteContainerTab.WebsiteContainerCol.value('WebsiteID[1]','int') AS WebsiteID,  
        				WebsiteContainerTab.WebsiteContainerCol.value('ContainerHeight[1]','float') AS ContainerHeight,  
        				WebsiteContainerTab.WebsiteContainerCol.value('ContainerWidth[1]','float') AS ContainerWidth,
        				WebsiteContainerTab.WebsiteContainerCol.value('IsRightAligned[1]','bit') AS IsRightAligned    
                  FROM @WebsiteContainerXML.nodes('//WebsiteContainer') AS WebsiteContainerTab(WebsiteContainerCol) 
        		
        
        IF @@ERROR <> 0
         BEGIN
        
            ROLLBACK
        
        
            RAISERROR ('Error Inserting in WebContainers', 16, 1)
            RETURN
         END
         COMMIT 
        
        END
        

        You can refer the syntax to retrieve and iterate through the serialized list and then inserting into the database.

        Important to make a note that you don’t have to manually iterate through to get the count and then again run some loop inside the stored proc for storing the above syntax will automatically iterate through all the nodes and insert each record.

        Happy Programming!!!!!!!!!!!!!!!!!!

        Monday, July 20, 2009

        Integrating Silverlight 2.0 with Sharepoint MOSS2007

        Silverlight is a revolutionary technology and its much in demand these days,Sharepoint is an old player but very extensive and offer a lot of features which make it alluring for medium to large enterprise.

        Sharepoint already provide a lot of out-of the box features but as silverlight is catching up every now and then you will have a requirement from the client to integrate silverlight with sharepoint.

        So in this article i will tell you how to integrate silverlight with sharepoint.Although there can be various ways of doing so i m following the webparts approach as it seems simple to me there are other simple approaches in which we can add a contentweb part in which we can give the source of the iframe as an hosted xap on silverlight live streaming server’s but being a developer this approach seems to me a little creepy and also there are very few resources which clearly tell how to integrate silverlight 2.0 into Sharepoint or MOSS2007.

        1. Create a silverlight 2.0 application and copy the xap and project .dll file in a separate folder.
        2. Configure MIME Types on the sharepoint server to accept .xap,.xaml,.xbap file extensions.
        3. Change the web.config of the application or website where you want silverlight to be integrated.
        4. On the sharepoint server create a WebPart project.
        5. Copy the resources i.e xap and the project dll file in the directory specified in the web part project silverlightcontrol source
        6. Deploy the webpart project to the required site where you want silverlight to show up.
        7. Edit the page where you want to add the silverlight control and click add webpart and you are done.

         

        1. Create Silverlight 2.0 application
          • Create a silverlight 2.0 application and build that solution and copy and past its xap file and the project dll file into another folder whose content we will copy later into the wwwroot and website name of the sharepoint site where we want to deploy this silverlight application.
        2. Configure MIME types in IIS on the sharepoint server
          • If you don’t have mime types configured on your iis server on the machine where you have your sharepoint installed, then first step is to configure the mime types on the IIS.
          • For IIS 6 you can either right click on whole of the website section or on specific website where you want the mime types to be configured.After right clicking go to the http header section from there select the mime types.

          • After selecting mime types click on new if the silverlight mime types are not present.

          • Add all the three mime types shown in the above figure and then click ok.Now your IIS is configured to accept and render xaml, xap and xbap

        3.Change the web.config file of the sharepoint website for which you want to integrate silverlight.

          • This is very important step because if you leave this step in between even if you do all other things correctly then also nothing will get rendered in the final webpart when you deploy the webpart and include it on your page.
          • So we have to follow a little hacky approach in order to get the configuration file correct.
          • So first step is open your visual studio and create a new asp.net 2.0 application

          • We are creating asp.net 2.0 application because sharepoint is using mostly asp.net 2.0 references and it’s not having any web.config enteries related to silverlight and ajax features of the 3.5 framework.
          • It is recommended to make a copy of the web.config so that if any error occurs you can restore the original version.
          • Now we should open the web.config of the sharepoint website in the same solution.web.config of the sharepoint website can be found at “c:\inetpub\wwwroot\wss\VirtualDirecotries\yourwebsitename\web.config”
          • Open this web.config and copy and paste the content in the original asp.net 2.0 web application web.config.
          • Now right click on the web project and click properties and change the target framework to .net framework 3.5 and then save the web.config file for the sharepoint website.

          • Now you have to add the following two entries in your web.config, first one is in the <system.web><compilation><assemblies> section add the below line
        <add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          • Next entry to be added is in the <system.web><pages><controls> section just add the line as given below
        <add tagPrefix="asp" namespace="System.Web.UI.SilverlightControls" assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

          • After adding these two entries just save the web.config file and you are done with the web.config changes.

        4.Create a webpart project on the sharepoint server

          • For creating a web part project in Visual Studio 2008 you need to install  “Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions, Version 1.2” which can be downloaded from here
          • After installing WSS3.0 tools Visual studio extensions you will have a new Sharepoint project type in C# section,from there choose webpart project and give your project some name.

          • Delete the default webpart folder which will be created and click on the add new item and then select webpart from the list.

          • Add two references to this project one is System.Web.Extensions and the other one is System.Web.Silverlight

         

          • In the yourwebpartname.cs file make changes so that it should look similar in code as given below
        using System;
        using System.Runtime.InteropServices;
        using System.Web.UI;
        using System.Web.UI.SilverlightControls;
        using System.Web.UI.WebControls;
        using System.Web.UI.WebControls.WebParts;
        using System.Xml.Serialization;
        
        using Microsoft.SharePoint;
        using Microsoft.SharePoint.WebControls;
        using Microsoft.SharePoint.WebPartPages;
        
        namespace TangramWP
        {
            [Guid("6b31932f-7245-4d78-912c-56033008e775")]
            public class TangramSilverlightWP : System.Web.UI.WebControls.WebParts.WebPart
            {
                private Silverlight silverlightControl = null;
                public TangramSilverlightWP()
                {
                }
                protected override void OnLoad(EventArgs e)
                {
                    base.OnLoad(e);
                    ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
                    if(scriptManager==null)
                    {
                        scriptManager = new ScriptManager();
                        this.Controls.AddAt(0,scriptManager);
                    }
                }
                protected override void CreateChildControls()
                {
                    base.CreateChildControls();
                    silverlightControl = new Silverlight();
                    silverlightControl.ID = "TangramSilverlight";
                    silverlightControl.Source = "/Bin/Tangram.xap";
                    silverlightControl.Width = new Unit(500);
                    silverlightControl.Height = new Unit(400);
                    Controls.Add(silverlightControl);
                }
            }
        }
        

        5.Copy resources such as xap and the project dll inside the specified location inside the sharepoint website.

          • Now in the bin directory of your sharepoint website just copy your .xap file and the silverlight application which is in my case Tangram.dll.

        6.Deploy the web part solution created

          • Right click on the solution and click properties in the debug section just change the “Start Browser with url” with the location of your sharepoint website.

          • Right click on the webpart solution which you have created and just click deploy to deploy the solution to the sharepoint website.

          • After successful deployment click on the edit page section in the site actions of your website and select the web part which you just deployed its generally in the miscellaneous section.

        If all goes well and you have followed each step you will see the silverlight application rendered in your webpart.

        Happy Programming!!!!!!!!!!!!!!!!!!!!