KR.Senthil’s .NET RECIPE

Blogging my professional and personal experiences in career and living

ASP.Net Impersonation and Could not load file or assembly error.

Posted by senthilsweb on October 20, 2008

In my recent ASP.NET project we used ASP.NET Impersonation to gain access to file server which is physically separated from ASP.NET web server (WINDOWS 2003 Server).We defined impersonation in the web.config file as

<identity impersonate=”true” username=”TestUser” password=”P@ssw0rd” />

We faced with following error while accessing our application for the first time after deployment.
impersonation&couldnotload
It is a permission related issue for the Temporary ASP.NET Files. The solution to the above problem is
giving read/write” access permission for “Everyone” user on 

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

The MSDN Says [ASP.NET Impersonation]:

The application identity that is being impersonated needs to have read/write access to this directory. The impersonated application identity also requires at least read access to the files in application directory and subdirectories.

Note: Actually we tried giving read/write access to the application identity that is being
impersonated but it didn’t work then we
gave read/write permission to “Everyone” user and it worked.

Posted in ASP.NET, Debugging ASP.NET | Leave a Comment »

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 »

Two Byte Space and System.IO.DirectoryNotFound Exception in Japanese .Net Application

Posted by senthilsweb on September 25, 2008

If you are doing IO operations in .Net applications in Japanese Environment (Multibyte), you need to take care two byte spaces in the Directory name (I mean the last character of the directory name is two/multi byte space) otherwise you will end up in getting System.IO.DirectoryNotFound Exception in case if you do not included “\” at the end of the directory

Example:

string[] fileList = System.IO.Directory.GetFiles(<path to the directory>)

1. <path to the directory> => c:\xxx\yyy ”

2. <path to the directory> => “c:\xxx\yyy \”

If you use 1 , you will end up in getting System.IO.DirectoryNotFound Exception

Note:
You cannot create directory with the last character as single byte space in windows explorer but the two/multi byte space is allowed.

Posted in General .Net | 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 »

Our three years journey in the land of rising sun JAPAN, Matsuyama @ Shikoku Islands

Posted by senthilsweb on September 22, 2008

Cherry Blossom Tree at DOGO Park, MatsuyamaMatsuyama CastleDSCF0061

After nearly 3 long years (Feb 2006 – Sep 2008) in association with Digitapia Corp, a pure Japanese IT company headquartered in a wonderful scenic calm city Matsuyama located in Shikoku Islands JAPAN, now the time has come to leave Digitalpia but my association will continue with them in different avenues.

After 6.5 years of IT work experience in various levels from programmer to Project Lead in India and USA ,I left my job in India and headed to JAPAN to pursue my masters in Information technology @ ehime university. Due to scholarship issues I could not pursue my masters and at that time Digitalpia offered me a JOB at their head office Matsuyama where I am the first & last foreigner to them and no body speaks English (a 100% pure JAPANESE IT Company) nor they have translation support. From the day one I been involved in customer projects and at the same time learnt to converse in Japanese on board with the help of my fellow colleagues, it was really hard initially till i get used to their process. The IT process (not institutionalized but Nationalised I would say) follwed in Digitalpia (JAPAN ) helped to accelerate my adaptability in terms of Japanese IT work culture.

dsc00166

Ashwini at her school park

By April 2006 my family (Wife and my 3.5 years old daughter) joined me and we put our daughter in Japanese kindergarten and then my wife took 6 months intensive Japanese Language course from ehime university. With the help of her father & through Kuroda San our apartment owner she managed to get a part time job @ ABC Retail outlet and at the same time attended her language class at Ehime University and EPIC as well. In the mean time my daughter picked the Japanese pretty fast and she started teaching us the language in a hassle free manner and through her we came to a comfort level in conversation Japanese. All three of us continuously learnt Japanese and my daughter slowly changed to native level speaker. The days passed pretty fast and I proved myself worth at Digitalpia and becoming one of the core team member there, so for delivered around 8 customer projects all with in the stipulated dead line (no schedule slippage, a great team effort and experience). Later my wife got a second job as Physical Therapist Assistant @ Tachebana Hospital IYOSHI a small town which is 10 miles away from matsuyama in align to her original profession Physiotherapy. In spite of cultural and language barriers and work pressure the life was going smooth. In the mean time when my daughter is ready for shogakko (Primary School) we were looking for English medium education around matsuyama but nothing existed as per our requirement except few run by Americans in the outskirts but are very expensive which we cannout afford, but even then we sent her at different private english  tuition centers run by Australians, American but nothing works out like Indian Education System. Since the lingua franca in India is English and we are not sure how many years we will be in Japan so we started looking for possibilities to relocate back to India [or] Tokyo but finally decided to move to INDIA. My family already moved and I am joining them on September 27 2008 after completing all my commitments at Digitalpia with smooth business continuity.

My interview at Digitalpia:

Personal interview by my sacho san with the help of a translator (My Father In Law). During my interview I explained my experience and projects by running through a power point presentation (CV converted to presentations with certain modifications).

After my interview they asked me to send some of my project works in terms of source codes

They evaluated my source codes and at the same time they did a detailed  analysis on my background  & Education. My USA experience and my work experience in Hewlett Packard & Infosys technologies gave enough positive sign for my rating. With all that they developed detailed report with score card to justify their decision analysis.

It is time to thank eveyone who helped us in our JAPAN journey.

subra

Dr.Subramanian, Ashwini, Sangeetha my sister in law & my wife Shobana at Beppu Islands, Oita, Japan

First and the for most is my father in law who is an Associate Professor at University of Ehime, Matsuyama, Japan and only through him I got inspiration about JAPAN and Japanese language and who facilitated my Japan entry.

with-sacho

Me with Sacho Takahashi San & his wife Satomi San at my syanora party

Thanks to Takahashi San and his wife Satomi San, SACHO (President) and Board of Director of Digitalpia. Usually Japanese are reluctant to hire a foreigner and that too who does not know Japanese. My sacho went ahead and hired me and I also proved that his decision in my recruitment was worth. he wanted to have me in his company for ever but unfortunately I have to leave them on personal backgrounds but we will maintain our relationship and if possible may extend it in terms of business possibilities to INDIA.

Thanks to all of my colleagues at Digitalpia

Digitalpia's dynamic agile team at banks of Huangpu River, the scenic bund in Shanghai the modern China.

Digitalpia's dynamic agile team at banks of Huangpu River, the scenic bund in Shanghai the modern China.

  • TAMAI san  – CTO
  • Onishi san, Yamaguchi san & Mihara san -  PMs
  • Tamai Jun San, Morinaka San – Senior Technology Consultant & Infrastructure Expert deputed at NEC Matsuyama and Takamatsu
  • Masaoka San, Nakayama San (Consultant from Lips) & Umeoka San – Lead Developers aka Analyst Programmers
  • Yamataka San, Hiragata San – Lead Developers aka Analyst Programmers
  • Uaeoka koon & Tokumatsu koon – SEs
  • Fukumoto San – Finance, Facilities and HR

Almost I worked with all the mentioned colleagues in various different projects.

Thanks to my Indian & Japanese friends in Matsuyama

  • DR.Malarvannan – Doing PhD in Environmental Studies at Ehime University
  • DR.Thangavelu –  Doing research in Biotechnology field @ Ehime University
  • Devanathan – Who just graduated from Ehime University with MS degree in Environmental Studies and entering into PhD
  • DR.Ramu & Mrs.Oyuna Ramu- Doing Post Doctorate in environmental studies
  • Subramanian – Project Manager at HCL technologies deputed at NEC systems Matsuyama since 2004
  • Tanaka sensei – My private Japanese instructor
  • Kuroda San & Noriko San – Our Apartment owner
  • Osaki San – A great guy always helps to foreigners in Matsuyama
  • Employees at EPIC (Ehime Prefectural Information center) & MIC (Matsuyama International Community)
  • Murakami San – My once colleague at Digitalpia
  • people at Ladki Indian restaurant, Matsuyama -  The owner at Ladkhi takes special attention to all Indians and also delivers excellent NAAN and Tandoori
  • Tanaka San and Sato San – Guys working at NTT telecom Matsuyama who helps foreigners in setting up Internet and Telephone Connections well beyond the expectations

Last but not the least,  the important person to thank is Rajkumar, My Project Manager at Infosys Technologies Bangalore and under him I learnt a lot of good things in terms of soft skills, technical abilities, confidence, positive attitude,Decision Analysis, sincere & honest and hygiene in the quality  of the deliverable so on and so forth, he used to criticise my negatives and not stopping there he used to give solutions to overcome from that which very very rare people does and the one is Rajkumar. All that learning’s under him helped me to survive individually with out much support in a Strong Japanese Work Community at Digitalpia.

It is sad leaving Japan but I am happy that we learnt Japanese Culture, Language and developed new Japanese relationships which I hope certainly adds value.

Syanora to all my friends and colleagues in Japan

Posted in Living In Japan | Leave a Comment »

My Company Digitalpia Corp(JAPAN) team trip: Matsuyama,JAPAN – to Shanghai, China

Posted by senthilsweb on September 22, 2008

 

Digitalpia Team

Digitalpia Team

August 18 2008 we (Digitalpia, My Japanase IT Company) had been to shanghai China for a three days sight seeing trip from Matsuyama, JAPAN and it was wow, a fantastic trip. For me it was a great new experince because i am the only foreigner in my company and rest all are japanese but being working for them for nearly 3 years I picked up comfortable spoken Japanese.

 

When I was working for Infosys Technologies Bangalore @ Technology Excellence Division, IS department I came to know a lot about shanghai and its growth esspecially in IT sector because our IS department is having a branch in Shanghai and our people frequently visit shanghai on business trips and they do visit infy Bangalore and through them I got a chance to know more about Shanghai. Since moved to Matsuyama on 2006 I was planning for a trip to shanghai, it is just 1.5 hours fly from Matsuyama and that happened through my present company Digitalpia.

Posted in Digitalpia, Travel | Tagged: | 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 »

WebPage To PDF Conversion Sample Application

Posted by senthilsweb on September 3, 2008

In my earlier post I worte about freepdfconvert.com’s free webpage to pdf conversion service, in continuition to that I created a simple proof of concept sample application using ASP.NET, JavaScript and Yahoo UI aka YUI. Click here to view the live demo

formThe sample application has got a simple form with one text box control, submit and clear buttons. YUI is used to show the progress bar message during the execution of the conversion process. Once the conversion is complete, the generated pdf document will be deliverd through windows save dialog and then the progress bar message disappears (AJAX like downloading). AJAX like functionality is achieved through the usage of dynamic invisible iframe with a call back function.

progress

save

HTML Form (aspx page)

html_form

C# code behind (I am injecting the required YUI js files through code behind) . You can directly reference inside script tags.

Note: YUI is used just for progress message and cosmetic.

c#

var progress;
/*-------------------------------*/
YAHOO.util.Event.addListener(window, "load", function() {
      progress = new YAHOO.widget.Panel("progress",
                                            { width: "240px",
                                              fixedcenter: true,
                                              close: false,
                                              draggable: false,
                                              zindex:4,
                                              modal: true,
                                              visible: false
                                            }
                                        );
     progress.setHeader("Generating PDF File, please wait...");
     progress.setBody("<img src=\"<a href="http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif\&quot;/">http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif\"/</a>>");
progress.render(document.body);
});
/*-------------------------------*/
function download()
{
    var txtUrl = $get('<%=txtUrl.ClientID %>');
    if(txtUrl.value==null || txtUrl.value=="")
    {
        alert('Web Page URL Cannot be empty!');
        txtUrl.focus();
        return false;
    }   
    //
    progress.show();   
    //
    if($get("ifraDownLoad")!=null)
    {
        DestroyIframe($get('ifraContainer'), $get("ifraDownLoad"));
    }
    //
    CreateIFrame($get('ifraContainer'),"ifraDownLoad");
    //
    var objFrame = $get("ifraDownLoad");
    objFrame.onload = function (){ callback("ifraDownLoad"); } //Attach Callback function
    objFrame.style.display = "none";
    objFrame.style.height = "1px";
    objFrame.src = getUrl();
    return false;
}
/*-------------------------------*/
function getUrl()
{
    var txtUrl = $get('<%=txtUrl.ClientID %>');  
    var url = "<a href="http://web2pdf.freepdfconvert.com/HTMLtoPDFTemplate.aspx">http://web2pdf.freepdfconvert.com/HTMLtoPDFTemplate.aspx</a>?";
    url +="cURL=" + txtUrl.value;
    url +="&author=";
    url +="&subj=";
    url +="&title=";
    url +="&app=http://www.freepdfconvert.com";
    url +="&keywords=";
    url +="&allowcpy=";
    url +="&allowmodif=";
    url +="&allowprn=";
    url +="&keylen=";
    url +="&userpass=";
    url +="&ownerpass=";
    url +="&preservelinks=yes";
    url +="&compress=flate";
    url +="&marginleft=";
    url +="&marginright=";
    url +="&margintop=";
    url +="&marginbottom=";
    url +="&psize=";
    url +="&porient=";
    url +="&ctype=";
    url +="&allowscript=yes";
    url +="&outputmode=stream";
    return url;
}
/*-------------------------------*/
function callback(frameid) {
progress.hide();
}
/*-------------------------------*/
function CreateIFrame(oSrcCtrl,strFraId) {
    var iframe = document.createElement("iframe");
    iframe.setAttribute("id", strFraId);
    iframe.setAttribute("scrolling", "no");
    iframe.setAttribute("frameBorder", "0");   
    oSrcCtrl.appendChild(iframe);
}
/*-------------------------------*/
function DestroyIframe(oSrcCtrl,oFrame)
{    
    if (document.all)
    {
        document.all[oFrame.id].outerHTML = '';
        oFrame=null;
    }
    else
    {
        oSrcCtrl.removeChild(oFrame);
        oFrame=null;
    }
}

Posted in AJAX, ASP.NET, Javascript, Reporting, iFrame | Tagged: , | 1 Comment »

HTML/WEB 2 PDF Made Easy using http://www.freepdfconvert.com/

Posted by senthilsweb on September 1, 2008

Most of us know about the free web2pdf service offered by pdfonline but today I found http://www.freepdfconvert.com out smarts PDFonline’s service in the sense it can be easily integrated into any web page with out letting the user as if we really use http://www.freepdfconvert.com. In their web site they have a form to key in the URL of the web page which will be converted to PDF on the fly and the form looks like the one below

freepdf

I said we can easily integrate this into any web application but how? the real magic is behind the URL of the controller page and query string params they use for conversion, it is pretty open and not documented. They are using the the target URL as (for easy readable I split the params)

http://web2pdf.freepdfconvert.com/HTMLtoPDFTemplate.aspx?
cURL=www.google.com
&author=
&subj=
&title=
&app=http://www.freepdfconvert.com
&keywords=&
allowcpy=&
allowmodif=
&allowprn=
&keylen=
&userpass=
&ownerpass=
&preservelinks=yes
&compress=flate
&marginleft=
&marginright=
&margintop=
&marginbottom=
&psize=
&porient=
&ctype=
&allowscript=yes
&outputmode=link

I didn’t explore much except just two things in the param i.e. cUrl and outputmode.

cURL = Specify the target webpage

outputmode = link / stream

If you specify as “link”, then the generated pdf file rendered as hyperlink and we need to manually click for downloading the pdf but if we specify as “stream” then it will show up the download dialog window.

The output mode is the prime factor in this free service which made the PDFOnline’s service to lower rank. The quality of the generated PDF document is also really good.

Using simple JavaScript and Iframe we can easily integrate this service into any web site for generating PDF document out of dynamically generated web pages (i.e ASP.NET, JSP, PHP etc.) as long as this service is visible (I am not sure how they made it open and I suspect whether it is a security hole!)

I will post a simple web app using this tool soon.

Posted in Reporting, iFrame | Tagged: , , | Leave a Comment »