murugangs

This site

Sponsors

  • MaximumASP
  • Social Bookmarking
    Online Shopping
    asp.net hosting
    UK online local dating

To flip or rotate the screen in windows xp

Some time accidently or intentionaly you may flip/rotate your xp screen but don't know how to come back to original possiotion. To do that use Ctrl+Alt+arrow (left,top,right,bottom) keys to flip accordingly 

.Net Framework source code & offline debugging

We now know that .net source code is release by MS. Scott Guthrie posted the whole story here. Scott talks about getting the content inside VS.net 2008, but some time we want the content outside of vs.net, also at offline (not connected to internet). The .NET Mass Downloader facilates this. The codeproject article taks about usage of this tool.

 Cheers,

Murugan G. 

Posted: Mar 03 2008, 10:05 AM by murugangs | with no comments
Filed under:
log4net in asp.net 2.0

Phil Haack explain in detaile here configuring log4net in asp.net 2.0. The thing is we need to tell log4net, where its configuration is kept. There are two approach,

  • keep this info in the assemblyinfo.cs as attributes, or
  • use XmlConfigurator.Configure() in Application_start() event.

The issue is If we follow the first approach, the log4net.dll can be kept in either webapp\bin directory or in GAC, whereas if we follow the second approach, it ONLY works when the assembly in the webapp\bin directory.

So If your log4net is not working, eventhough you kept the file in GAC, keep th file in the bin directory and mostly it works!

 Cheers,

Murugan G. 

Posted: Feb 24 2008, 06:53 PM by murugangs | with 1 comment(s)
Filed under:
How to override or customize the Sharepoint SaveButton?

The SDK documentation explains here [1] how to override the ListFiledIterator to a Document Library by changing the template. I need to change the Sharepoint SaveButton so that I can do some additional task after or before saving.

These are the steps I followed to do this:

  1. Create a custom type inheriting from Sharepoint SaveButton.
  2. Override the protected SaveItem method, and do the custom code which you want.
  3. Create a Control Template, which overrides the default Sharepoint default implementation (here was I spent lots of my time to figure it out to achieve this)

The key is you have to replace the default declaration with your custom assembly and type, which you created in step a.

Change the control template of your custom control template from this

<wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl"    RightButtonSeparator="&nbsp;" runat="server">

      <Template_Buttons>

            <SharePoint:CreatedModifiedInfo runat="server"/>

      </Template_Buttons>

      <Template_RightButtons>

            < SharePoint:SaveButton runat="server"/>

            <SharePoint:GoBackButton runat="server"/>

      </Template_RightButtons>

</wssuc:ToolBar>

to this:

<wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl"    RightButtonSeparator="&nbsp;" runat="server">

      <Template_Buttons>

            <SharePoint:CreatedModifiedInfo runat="server"/>

      </Template_Buttons>

      <Template_RightButtons>

            <CustomOverrideControls:CustomSaveButton TemplateName="SaveButtonNew" runat="server"/>

            <SharePoint:GoBackButton runat="server"/>

      </Template_RightButtons>

</wssuc:ToolBar>

 
Define the SaveButtonNew template as follows:

 <SharePoint:RenderingTemplate ID="SaveButtonNew" runat="server">

      <Template>

            <TABLE cellpadding=0 cellspacing=0 width=100%>

            <TR><TD align="<SharePoint:EncodedLiteral runat='server'                            text='<%$Resources:wss,multipages_direction_right_align_value%>'                    EncodeMethod='HtmlEncode'/>"  width=100% nowrap>

            <asp:Button UseSubmitBehavior="false" ID=diidIOSaveItem                             CommandName="SaveItem" Text="<%$Resources:wss,tb_save%>"

            class="ms-ButtonHeightWidth" accesskey="<%$Resources:wss,tb_save_AK%>"

            target="_self" runat="server"/>

            </TD> </TR> </TABLE>

      </Template>

</SharePoint:RenderingTemplate>

 
This is exact copy of the exisiting SaveButton RenderingTemplate declaration except the ID, which currently tells as our custom control template name.

 
I also attached a sample project which implements the custom type and the custom control template file (CustomControl.ascx, the name really does not matter) which needs to be placed in the "12 hive" ControlTemplates folder.

 
Cheers,

Murugan G.

How to re-deploy an errored .wsp template in sharepoint?

I tried deploying the great 20 templates, but failed. This is happens because I first tried installing the individually downloaded file, without knowing that it does not include the primary applicationtemplatecore.wsp file. So I again tried installing, as beautifully documented here, after downloaded the single installable which contains all the 40 templates.

 

Unfortunately I am not able to deploy it successfully. when I checked the status in Solution Management I have all the templates with the status as Error. How can I redeploy it successfully?

 

First, de-associate the template with the associated job by going to Timer Job Definition in operation tab, then delete the job.

 

Open the Solution Management in operation, click the individual template to delete it.

 

Once again run the commands as documented here..

 

That’s all.
TTP/1.1 500 Internal Server Error or Server Application Unavailable issue with IIS

Some times we get this error when we create a new web application or open an existing application in vs.net 2003. Most of the time issuing the aspnet_regiis -i command will solve this issue.

But i got this error and tried it with no luck. The solution worked for me is this as mentioned here, here.

-- Delete the ASPNET account,

-- execute aspnet_regiis -i,

-- execute iisreset.

The issue is fixed for me now. But i don't know whether it is a temp or permanent solution.

 

Posted: Feb 20 2007, 02:21 AM by murugangs | with no comments
Filed under:
Invoking FxCop project file Inside visual studio.net

The FxCop documentaion clearly mentioned integrating FxCop with vs.net here. The /r option is the location name where all the rules assembply placed. If we used this option all the rules applied while analysing the assembly. Sometime we need to analyze the assembly with some exclusion. This can be easily done by unselecting some of the rules and saving the default FxCop project to some other name, say MyCompanyFxCopRules.FxCop.

We can invoke this file from the integrated environment by removing the /r option and adding /p option, which allows to analyze the assembly with selected rules only. Make sure that the current project and the custom FxCop project (in our example MyCompanyFxCopRules.FxCop) are located in the same drive, otherwise an error message will be displayed in the output window, as these two should be located in the same drive.

Posted: Nov 06 2006, 07:45 PM by murugangs | with no comments
Filed under:
Show hide asp.net 2.0 navigation controls element.

We can bind the sitemap file to the navigation controls like treeview or menu using sitemap provider. The asp.net 2.0 site navigation feature overview can be found here.  We define the navigation structure for the whole site using the sitemap file, but based on the logged in user we need to show or hide certain navigation elements.

 

 Sitemap security trimming does very good job by hiding or showing a sitemap node based on security roles. To do that, we have to set securityTrimmingEnabled to true in the web.config file where we configure the sitemap providers.

 

But some time we need to hide a particular navigation element even though the logged in user has access to the page. For example a user who plays the manager role is allowed to view all his reportees info, but when no user is assigned to him as a reportee, displaying the page is not much useful rather we can hide the navigation element.  SiteMapProvider.IsAccessibleToUser allows to  customize hiding/showing the particular sitemap node based on the business logic. To do that we need to define a custom sitemap provider inheriting from XmlSiteMapProvider, and override the IsAccessibleToUser method implementing the business logic.

 

Instead of checking for all the sitemapnode we can add a new element and specify to which roll we want to hide the menu. For example we want to hide the reportees.aspx page for manager role.

<siteMapNode url="~ /reportees.aspx" title="MY Reportees"  description="" hideFor="Manager"/>

 

Then we can check whether the current node requires hiding based on business logic, if so we hide by returning false.

 

public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)

{

// The node does not required a business logic.

      if(node["hideFor"] == null) return base.IsAccessibleToUser(context, node);

 

string hideFor = node["hideFor"].ToString();

      if (context.User.IsInRole(hideFor ))

      {

            // your business logic here to determin whether the element should

            // be shown or hidden from the current user.

            return false;

        }

      }

}

Posted: Jul 09 2006, 03:17 AM by murugangs | with no comments
Filed under: