KR.Senthil’s .NET RECIPE

Blogging my professional and personal experiences in career and living

Archive for the ‘Uncategorized’ Category

Sanju, new arrival to our Family

Posted by senthilsweb on October 20, 2008

sanju

We are happy about Sanju, our new baby boy born on October 2nd 2008 the day Gandhiji the Father of India was Born.

sanju1

We named our little one "Santosh" [nick name Sanju].

Our first child, Ashwini who is now 6 years old born on August 15th the Day India celebrate its Independence day. It is so fortunate that we delivered our both the child the whole Indian Nation celebrates with sweets.

Posted in Uncategorized | Leave a Comment »

FORTUNATE VISIT TO IKAZAKI ANNUAL KITE FESTIVAL

Posted by senthilsweb on September 25, 2008

P5050319 P5050321  P5050323

My ikazaki trip album

During this may 2008, golden week holiday I planned to make a visit to OZU hills Ehime for trekking to Mt.Tomizuyama to see the 65000 Azalea flowers. On my way back to matsuyama from OZU fortunately I got a chance to attend the Annual kite festival at IKAZAKI near UCHIKO town in Ehime. I have read about kite festival but seen it only in movies (SHIVAJI the Boss Tamil Movie, kokku para para …kozhi para para)before IKAZAKI trip. The experience was supereb because the weather was pretty good that day and the place where the kite festival hosted was very very scenic i.e. the place IKAZAKI is fully surrounded with thick mountains and river Oda flows and it is a very very fertail place. In tamil language I would call the place as “ALAGIYA PALLATHAKKU”. Added to that natures beauty at IKAZAKI, seeing the huge and colorful fighting kites was marvellous and wonderful experience (In japanese I would say “iie kimochi”, the feeling was good)……

Ikazaki is a rural town famous for its annual kite festivals and particularly for its fighting kite battles. These kite ‘wars’ have been taking place here for over 400 years.It’s held in May on the day set aside as Children’s Day in Japan. On this day families set up special diplays and pray for the future happiness of children born the year before. At Ikazaki many of the kites are flown in honour of children. The child’s name and good wishes are usually painted on the kites flown for them. This too is a tradition dating back in time.

Posted in Uncategorized | Leave a Comment »

Diving into Domain Driven Design (DDD) & Test Driven Design (TDD)

Posted by senthilsweb on September 22, 2008

In my current project I used quiet a lot of c# .net generic collections and custom entities, I mapped my DB fields to my custom entities manually and created DAL manager classes hand coded which consumes lot of coding & time and prone to defects during changes.To take advantages of ORM tool in my forthcoming projects, I started exploring NHIBERNATE . I kicked my learning by watching the video tutorial Summer of NHibernate Screencast Series wow excited and admired by looking at the features of NHIBERNATE and with that I got exposed to TDD and DDD, followed by the screen cast I started reading the book NHIBERNATE in action to dive deep in to the internals of the NHIBERNATE. After entering in to the DDD I realised that I need to unlearn my usual MS way of thinking and need to learn the DDD way (ALT.NET). In this journey I am introduced to learn interesting new terminologies, approaches, patterns & practices, testing methodologies, tool sets etc.

 

Due to NHIBERNATE, the tool sets I am currently getting aquainted are SPRING.NET and CASTLE PROJECT of which SPRING.NET interests me much based on its rich features set for ASP.NET, DI, AOP, WEB SERVICES etc

 

Some of the terminologies I learnt new are

YAGINI - You Arent Gonna Need It
DRY - Don’t Repeat Yourself
IMPEDANCE MISMATCH
CODE SMELL
ALT.NET - Alternative tools and approaches to mainstream .NET
AOP - Aspect-oriented programming
DI - Dependency injection

and the list goes….

 

During my learning, I would like to create sample apps and post it here.

Posted in Uncategorized | Leave a Comment »

Handling blank spaces between strings in infragistics ultrawebgrid (grid column)

Posted by senthilsweb on September 10, 2008

 

I faced a strange problem while binding string data in infragistics ultrawebgrid column of data type System.String.My string data contains two consecutive blank (empty) spaces interleaved EX: “K100K01  EH 1000″ (two blank spaces between “K100K01″ and “EH”) and during databinding to the ultrawebgrid, it rendered as “K100K01 EH 1000″ i.e. one blank space has been stripped off. After little poking in to the ultrawebgrid colum properties I found out “HTMLEncodeContent” and which needs to be set as true i.e. HTMLEncodeContent=”true” to make the grid column render the sting as it is without losing double/multi spaces in the string data. This details have not been mentioned clearly in the infragistics help. Though this problem sounds simple but can lead to disaster based on the business requirement.

Posted in Uncategorized | Leave a Comment »

Things to look for Automatic ASP.NET Session Invalidation & Application Restart well before the timeout period.

Posted by senthilsweb on March 13, 2008

In my current ASP.Net Project, we are using Forms Authentication together with in-process session.During the course of development and testing, I have been facing issues in regards to automatic session invalidation well before actual timeout & also Application restart randomly.After through profiling of my application I nailed down the cause for it.

Session Invalidation:

I am pretty sure that every ASP.Net web developer knows the basics of session handling but at the same time many of us facing strange issues there! the application will not behave as expected. Due to the frequent changes in the technology especially in Microsoft platform I.e changes between the versions, the application will not behave according to the way we have thought of it.

In my current ASP.Net Ajax Web Application, I followed some of the best practices out there in the web with respect to handling session time outs:

Detecting ASP.NET Session Timeouts by Robert Boedigheimer

Detecting Session Timeout in ASP.NET 2.0 Web Applicationsby Nikhil Kothari

The Defibrillator: Keeping ASP.NET Session Alive Ad Infinitum By Thomas Kurek

My client’s requirement for session timeout period is 10 hrs, I thought this is just a web.config settings and went ahead and set the following in my web.config

<sessionState timeout=”600″/>

I consciously thought of forms authentication too and set

<forms loginUrl=”~/LoginForm.aspx” defaultUrl=”~/TopForm.aspx” timeout=”600″/>

Also In the IIS settings for session timeout, I made 600 minutes for my web site!

What I found during testing was, my application got redirected to loginpage.aspx exactly after 20 mins. I thought the session was timed out, this redirection is purely due to my custom code whenever new session is created. I couldn’t figure the problem then I jumped into googling without giving any opportunity to my thinking process [I think many of us doing the same thing!!!!!!!!] which brought me to the pages I have mentioned above which I already followed in my application. I took a little break and finally devised a plan to unearth the problem, it was nothing but running perfmon and catch the following counters Sessions Active, Sessions Abandoned,Sessions Timed Out,Sessions Total. For ASP.Net Performance counters, refer MSDN http://technet2.microsoft.com/windowsserver/en/library/58de2498-d7d7-4557-ae2f-e6435aac344b1033.mspx?pf=true

After configured and started Perfmon counters, I restarted my application and noted down the time and also noted down the number of Active session [In my test bed it was only one at that time]. After 20 minutes I checked my application and obviously the same result, it took me to loginForm.aspx [Custom Redirection] but my perfmon results revealed me no session timeouts but at the same time no active sessionsexactly after 20 minutes, it means that the culprit is not session and it may be application restart / ASP.Net worker process restart. After this result, again I did Google but with different search phrase and this time I got what I wanted

.net session timeout settings in IIS6 on windows 2003 serverby Sanjay kattimani

In IIS 6.0, The application will restart after the being idle for the set time, the default is 20 minutes  which can be seen under Application Pool settings I.e. Shut Down Worker Process after Being Idle for (time in minutes) default value is 20 minutes. After unchecked that option in my server [Win 2003 & IIS 6.0] it worked for me!.

During this exercise I also learnt the reason for ASP.Net Application restart at random. I know that any changes to ASP.NET bin folder [or] web.config file will make the application restart which is equivalent to restarting the application in IIS / IISRESET command. But I found the application behaves weird and gets restarted for JavaScript and html mark up changes! In the MSDN http://technet2.microsoft.com/windowsserver/en/library/58de2498-d7d7-4557-ae2f-e6435aac344b1033.mspx?pf=true under Application Restarts it is said as
The number of times that an application has been restarted during the Web server’s lifetime. Application restarts are incremented with each Application_OnEnd event. An application restart can occur because of changes to the Web.config file, changes to assemblies stored in the application’s \Bin directory, or too many changes in Web Forms pages. Unexpected increases in this counter can mean that unforeseen problems are causing your Web application to shut down. In such circumstances you should investigate as soon as possible.”

If you are using AJAX Updatepanels for partial post back and during session timeout, you will see this following JavaScript error message unless you are not handle it explicitly.

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12030I hope this post helps & saves your time.

Posted in Uncategorized | 2 Comments »

ASP.NET AJAX AND ASP.NET 2.0 ERROR: “Invalid postback or callback argument.”

Posted by senthilsweb on December 15, 2007

In my current ASP.NET 2.0 [AJAX] project, I came across this error

Invalid postback or callback argument. Event validation is enabled using <pages enableeventvalidation=”true” /> in configuration or <%@ page enableeventvalidation=”true” %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.”

After looking at the error message I immediately set enableeventvalidation=”false” at page level and do away with the error but I faced other problem i.e. I was not able to retrieve values of my controls [only specific control] during post back. The scenario goes like this:

My asp.net page has got the following server controls
1. Textbox,
2. Drop down list
3. Button
4. Grid inside an Updatepanel

In the client side onchange event of the textbox control, AJAX web service call is made and based on the result the drop down list gets populated dynamically. Upon button click, my gridview control which is inside the updatepanel should populate [expected result]. I was not able to get the selected value of the drop down list during partial post back and I couldn’t find the root cause immediately and at last after googling I got a good pointer about this issue is well explained by Scott Allen

http://odetocode.com/Blogs/scott/archive/2006/03/20/3145.aspx [Part 1]
http://odetocode.com/Blogs/scott/archive/2006/03/21/3153.aspx [Part 2]

At last I managed to get my expected results by introducing an hidden control where I set the dropdown list’s selected value through client side javascript code and then able to get the hidden controls value during partial post back [Kind of laborious and dirty way]. Time being the problem was solved. If i come across better approach I’ll update this post. If any of you have better solution please suggest.

Posted in Uncategorized | 1 Comment »