http://sufikatha.com
Nishanth's Blog | ASP.NET

Microsoft Releases WebSiteSpark - Free Micrososft Licenses for web development tools

by Nishanth 25. September 2009 15:42

 

Following softwares are provided free of cost when enrolled: 

  • 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) 

For more details visit WebSiteSpark website: http://www.microsoft.com/web/websitespark/

Edit XML Files Using ASP.NET TreeView Control

by Nishanth 15. August 2009 21:03
This article is published in AspAlliance.com and you can find it here: http://aspalliance.com/1873_Edit_XML_Files_Using_ASPNET_TreeView_Control

Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

.NET | ASP.NET | Microsoft | XML

ChartDirector font problem with chinese/japanese/korean fonts

by Nishanth 12. May 2009 00:11

I was working on a web app which supported 20+ languages across the world. One report which we developed was using ChartDirector (http://www.advsofteng.com/gallery.html) in verdana font. After development we found that ChartDirector is not displaying chinese/japanese/korean characters. it was displaying  junk boxes instead. On Investigation, it was found that the issue was with  Verdana as Verdana does not support Unicode characters for japanese, chinese , korean etc. I searched in the net for a solution and found in the ChartDirector forum that the tech support of ChartDirector is advising people to use a font called "MingLiU" (which I don't think is free). I didn't like the idea of installing seperate fonts for each locale that we support. Just then I thought why don't we use a common unicode font which is available with Windows. This thought took me to "Arial Unicode MS" which is the best bet for displaying all unicode characters and it was free with Windows XP/ Windows 2003. I replaced verdana with "Arial Unicode MS" in the code and it worked perfectly!!!

sample code:     bc.xAxis().setLabelStyle("Arial Unicode MS", 9);

 

 

Javascript for replacing n th character in a string

by Nishanth 2. April 2009 04:41
   
Javascript for replacing n th character in a string:
 
 
function RepalceCharacter(sourceString,stringTobeReplaced,index)
{
    var re = new RegExp('^(.{'+ --index +'}).(.*)$','');
    return sourceString.replace(re,'$1'+stringTobeReplaced+'$2');
};
 
//Test code 
alert( RepalceCharacter('nishanth','XSSSSX',3) ); 

Providing write permission to a file in Plesk

by Nishanth 10. December 2008 04:00

Today I uploaded a new module to one of my sites hosted with a third party hosting provider(www.2gbhosting.com). This module reads from and writes to an XML file but once I uploaded the code to the server, I found that the application was not able to write to the XML file. The reason, as I guessed was .NET Security Laughing. By default, all files are assigned read only permission for the ASP.NET worker process. So we need to give write permission on the XML file to the ASP.NET worker process.

2gbhosting uses Plesk(version 8.4.0) and I am describing here the steps required in this scenario to fix this issue in Plesk.

Steps:

1. Login to Plesk.-> File Manager -> Browse to the File -> Click on the Lock icon on the right side of the file.

2. You will reach "Setting up Access permissions" page .

3. Click on "Plesk IIS WP User (IWAM_plesk(default))" user.

4. On the right side, check in allow column against Write permission. 

5. Click on OK and you are done. 

Happy coding and hosting!!!

 

Page_Load method being called twice (randomly) in ASP.NET web application

by Nishanth 2. December 2008 21:03

First lets look in to the Architecture of this web application which I was working on:

The user will be redirected to a static HTML landing pagefrom where the user selects products using radio buttons and hits an htmlbutton which is coded as follows: 

<input name="image" type="image" src="../Images/buynow.jpg" class="buynowbutton_and"  id="BuyNow_0" onclick="return Redirect(this);"/>

As you can see, when the button is clicked, the javascriptmethod Redirect() is being called.

In this method, a url is constructed using the selected productids and redirected to the shopping cart page.

  document.forms[0].action= url;

 document.forms[0].submit();

 

Now the missing piece is that we should return a “false”after the redirection statement. This will prevent the page from posting  back again(which we don’t want to happen) aswe already redirected the page.

 Otherwise the browsermight get posted back ‘again’(This is quite random and depends on browser. Wehad issues with IE 7 ) and 2 ‘post backs’ will happen on the same page and itwill cause Page_Load to execute twice  ina multithreaded manner sharing the same session variables. This is a dangeroussituation. It leads to unexpected behavior of the ASP.NET application and itaffects the output.

In my case there was an if else loop in the Redirect()method which was causing the issue.

If(condition){

Do something;

//Missed the return false here.

}else

{return false;}

As you saw above the return false was not in if block, itsonly in else block. This code used to work initially and suddenly started tocreate issues.  

 

If your application has a client side redirect,then make sure that you disable the post back  returning a false in the onclick event toprevent the second post back. From another perspective, if you have two ormultiple unexpected Page_Load events happening on your aspx page and you are clueless(just like me initiallyJ), check whether you are returning the false inyour javascript after its execution(make specific checks on conditional statementsin the JS which might prevent the ‘false’ to be returned 
All Good Websites

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About Me

Nishanth Nair  

 A die hard fan of Rise of Nations... I write few softwares for McAfee Inc. for a living.

 

Portfolio:
http://Necab.org
http://SufiKatha.com
http://DeepaRecipes.com
http://ManipalFoundation.in
http://NetraArts.com
http‌://EnWebTech.com
Contact : Nair.Nishanth@Gmail.com 

All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer.

Tag cloud

The World This Second

free counters