A Place for C Sharpers/.Netters

I Will do coding till last moment of life-Kiran Patil

MSDN got a new look!

Posted by kiranpatils on November 1, 2009

One of my best friend MSDN – i guess yours too :) got a new look! Few days back while i was searching for something on MSDN – Which i always do :) i saw the new look of MSDN. It really looks a great and really few nice enhancements they did.

image

image

Switch View functionality is really great you can switch the views to Classic, Lightweight Beta and ScriptFree

Happy Reading!

Posted in Latest happenings, MSDN | Tagged: , | Leave a Comment »

How to Debug Windows Service

Posted by kiranpatils on November 1, 2009

Hi Folks, Sorry for being invisible for a long time. But i got really tied up with my bits. Anyways it’s good if i be more busy then i will get more stuff to write :)

First of All Happy Diwali And Happy new year to all of you! I hope this year you face so many challenges which makes you strong in your field!

Challenge

If anyone of you worked developing Windows Services in Visual Studio then one thing you must be wondering too do Debug – which makes programming easier. It’s not as easy as putting breakpoint and do debug like console,windows or web. It is an art to debug windows service.

Solution

To Debug windows service you can use Debugger.Break() method — Signals a breakpoint to an attached debugger.

So here are the steps to debug any piece of code in windows service:

1. Call Debugger.Break() Method before the line you want to put Debug point.

2. Now on the point which you want to get called put breakpoint. Means next line to your Debugger.Break() Line.

3. Now start your windows service. Whenever your piece of code executed. You will see Visual Studio Just-In Time Debugger Window. Choose VS instance and here you go!

Have a Happy Debugging!

Webliography

http://dotnettipoftheday.org/tips/how-to-debug-windows-service-startup.aspx — Another Blog

http://stackoverflow.com/questions/761120/how-to-debug-a-windows-service-using-breakpoints — Same Challenge

Posted in Windows Forms | Tagged: | Leave a Comment »

Get up to 25 percent off select Microsoft Certification exams

Posted by kiranpatils on October 4, 2009

Howdy! I just logged in today in to my MCP portal and found one great thing that MS is giving special discount on Certification exams..Yippee!!!

They have kept three slots : 15%,20% and 25%

All TS Level exams comes under 15% and 20% slot – TS Level means Technology Specialist exams. For example 70-536 comes under TS Level.

All PRO Level exams comes under 25%  slot – PRO Level means Professional level exams. For example 70-547 comes under PRO Level[Hoorah!! currently i am preparing for this exam :) ]

Best thing in this offer is that : This Offer is Good until December 31, 2009 or while supplies last.

So, if you take it positively then you got a reason to give exam before December and which will boost you to start preparation for the exam :)

So, to get your voucher code follow the steps as given below:

1. Go to this URL :

http://www.prometric.com/microsoft/careeroffer.htm

2. From the given table locate your exam code. for example 547 or 536

3. Right side of that column click on “Get Voucher” Link.

4. Fill the form. Please provide the valid e-mail ID. Because your voucher will be mailed to you.

5.Now keep this Voucher code with you and when you go to your local prometric center. Just provide that Voucher Code and you might need to provide the same e-mail id. Which you provided in last step.

6. Take your exam.

7. If you passed the exam  then plan the party for your friends by using the discounted amount :)

Pls note that it is valid by 31 Dec. 2009.

Good luck on your exam!

Posted in Latest happenings | Leave a Comment »

Showing Default Date and Visible Date with Calendar control

Posted by kiranpatils on September 2, 2009

Challenge:

if you are using Calendar control to show Birthday of your friend. So, when you run the application it will show whose b’day is coming in this month or next month or next month …. So, you can be ready for a treat :) . The Challenge here is how to select that particular date and how to make it visible while user runs the application?

Solution:

You can set SelectedDate of Calendar Control to show date selected like this:

DateTime dtBirthday = getUpcomingBirthday(); //assume this method returns upcoming b’day in DateTime

calBirthday.SelectedDate = dtBirthday.Date; //use Date here else it won’t work

You can set VisibleDate of Calendar Control to show that date:

calBirthday.VisibleDate= dtBirthday.Date; //use Date here else it won’t work

Here DateTime.Date part it too important. Else it won’t work. Do you know why? i know but it’s homework for you guys :)

Cheers

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

Form Reset With Validation Control

Posted by kiranpatils on September 2, 2009

Challenge:

Reset button won’t clear validation control messages.

Solution:

For that you have to write JS onclick of reset button and do hide it like this:

document.getElementById(“regurlarexpressionID”).style.visibility = “hidden”;

See this link:

http://forums.asp.net/t/567612.aspx

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

Programmatically Posting Data to ASP .NET Web Applications

Posted by kiranpatils on September 2, 2009

Usually what we do. We open a page and fill up a form and submit a form data by pressing “Submit” Button. And after that we get some data/response  as per the logic.  But how to do this programmatically?? — That’s what we have been doing since so long..we faced too many challenges and finally we made it working. You also want to do the same then here we go…

First follow this nice article :

http://dotnet.sys-con.com/node/45127

if you follow all the steps and also COPY-PASTE the whole code given below:

http://gemsres.com/photos/story/res/45127/source.html

IT WON’T WORK

As someone has already commented on that post — That it throws Internal Server Error(500). But unfortunately no solution has been answered. But don’t worry. i’m here to answer that :)

Okay, The problem is in your target ASPX page — Means ASPX Page which has form tag. it should have event validation false:

<%@ Page EnableEventValidation=”false” %>

That’s it. It should work now. And if it dosen’t works then try to debug using Fiddler — Really great tool

Okay, So in short to post form data programmatic ally using ASP.NET following steps are required.

1. ViewState Must be passed.

2. In Target page — enableeventvalidation – false.

3. Fiddler must need to install to see what’s going on :)

Webliography

http://xneuron.wordpress.com/2007/12/05/programmatically-post-a-form-in-aspnet/

http://schleichermann.wordpress.com/2009/07/13/asp-net-programmatically-submit-form-post/

Hope this helps :)

Posted in ASP.NET | Leave a Comment »

There is no script engine for file extension “.vbs”

Posted by kiranpatils on August 13, 2009

Challenge:

If you received an error saying There is no script engine for file extension “.vbs” then you are on right post :)

Solution:

I tried doing this : regsvr32 %systemroot%\system32\vbscript.dll

http://www.technologystory.net/2009/02/25/windows-vista-tips-there-is-no-script-engine-for-file-extension-vbs/

But like you — for me too no luck :(

But finally following trick worked for me :)

1. Locate the file %windir%\inf\wsh.inf (inf is a hidden
folder)

2.right click and select “Install”.

Happy Coding!!

Posted in Uncategorized | Leave a Comment »

svn: Can’t create tunnel: The system cannot find the path specified.

Posted by kiranpatils on August 13, 2009

We are using CruiseControl.NET for continuous integration. I must say really great tool!

We have configured a server where CruiseControl runs and our repository is on Tortoise SVN and it uses SVN+SSH. When we start our “ccnet.exe” it was giving us error like this “svn: Can’t create tunnel: The system cannot find the path specified.”

We really got confused as the message says the system can’t find the file specified But which file?? :(

After struggling a lot we found the solution..Here it is:

SVN_SSH Environment Variable value was like this[Won't Work]:

C:\Program Files\Putty\bin\plink.exe

It should be like this [Will work]:

C:\\Program Files\\Putty\\bin\\plink.exe

OR

C:/Program Files/Putty/bin/plink.exe

That’s it!!

If you are new and don’t know how to access Environment Variables see this:http://www.pushok.com/help/svnscc/index.php?redirect=adv_svnssh.htm

HTH

"Writing a code is a one kind of prayer for me"

Posted in SubVersion | Tagged: | Leave a Comment »

1000 point crossed on asp.net forums

Posted by kiranpatils on August 3, 2009

Howdy all,

I have a great news to share with you all. I have crossed 1000 points on asp.net forums..

Asp.net_Forums

Posted in Milestones | Leave a Comment »

MSI Installer for setup of Windows Service

Posted by kiranpatils on July 29, 2009

Challenge:

I have created one windows service and to install it i use “installutil.exe” — and to automate the task i have created BATCH files. But how can i do this using windows installer?

Solution:

Basically you need to add New project of type “Setup and Deployment

See this walkthroguh from microsoft : http://support.microsoft.com/kb/317421

Hope this helps :)

Happy Programming!

Posted in Windows Forms | Leave a Comment »