Monday, October 05, 2009

Deployment Issue: Crystal Reports embedded with .NET web application

Lot of people comes across the issue of Crystal Report deployment on production server. When they run the web application with reports embedded in to it, developed using Crystal Reports, it works fine on their machine but when they deploy the same web application on deployment machine, it gives exception as soon as any report is opened.

The problem here is that you have the CR runtime assemblies on your local machine; it's because you have installed VS, and CR runtime comes embedded in VS now. But on the production machine, we just have .NET framework, not the CR runtime.

So in order to make it run on production machine do the following:

  1. Create a new web setup project for your web application using VS web setup wizard and add your project output to it.
  2. Add appropriate merge modules (it installs the CR runtime on production server) to the setup project depending on .NET framework and CR version.

When we'll install the web application using the above created setup project, it will start working on production server as well.

Here is a tutorial that will help you do the above steps:

Happy Deployment! J

*CR= Crystal Report

*VS = Visual Studio

Tuesday, September 22, 2009

VS2008: Adding Web Service Reference, not hosted at default 80 port

Today I come across an issue while trying to consume a third party web service for B2B integration project. The web service has been hosted on some port i.e. 8097 other then default 80 port for IIS. When I try to add the web service reference in to my VS 2008/ ASP.Net 2.0 project it gives me this error:

Metadata contains a reference that cannot be resolved: ''.
There was an error downloading 'http:// '.
Unable to connect to the remote server

The web service i have been trying to include in my project was hosted at ''

I 'Binged' the problem, but I can't find anything, lot of people have put this problem but I didn't found any solution..

Here are the steps I took in order to resolve this problem:

  1. Add this web reference '' instead of default, it will generate the proxy but still you won't be able to call the web service.
  2. Next step is to go to Settings.settings in property folder of you project, open it you'll find a URL entry for your web service, its type is 'Web Service URL'. Go and change its value to ''
  3. Now check the web.config entry for your web service URL and make sure that it points to the correct URL with port included in it. [you need to do this step if the web service URL behavior is 'dynamic' ]

Happy Coding!

Tuesday, September 08, 2009

Web.Config: <authorization> Element

Here is the web.config snippet to allow access to only one user to web site or web service and deny access to all other users either authenticated or anonymous.

Allow Access to only one domain user

Allow access to any autheticated domain user











It will enable windows authentication and only allow user "basit" to access the web site or web service. It will deny access to all other users.

It will enable windows authentication and allow user "basit" and any other authenticated user to access the web site or web service. It will deny access to any anonymous user.

Thursday, September 03, 2009

Translation as a Service: Microsoft; Bing Translator vs. Google Translator

I just come across Bing Translator from Microsoft; I have been working on a multilingual web portal, so I have been using Google Translate quite extensively. I have also placed a code snippet in my previous post that can help anyone to translate variable names, web service response and error messages at run time from Google supported languages to English.

Today for the first time I come across Bing Translator and the first impression to this service I awesome, I really liked its auto detect feature, I tried it and amazingly it worked fine, WOW, so as predicted Bing is going to give hard time to Google. Competition always helps companies to grow and at the same time provide better services to the end users.

An early look at the Bing Translator shows that it provide a lot more features as compared to Google Translator.

It has tools for end users, providing lot of good quality services like you can add an MSN blog for translation, that's really cool.

It also provides cool tools for the web master and last but not the least, tools for Developers J to build cool multilingual applications using any of the available options, good things is that it has support for JavaScript through AJAX Interface API. I look forward to lot of cool applications written on top of it.

I believe there is a huge potential in this regard building translation as a service, and I think Microsoft is right on track this time!

GMail goes down once again!

Gmail is down again, and what's the excuse this time :)

But this error seems unfair to the user, there should be a specific error message for it going down.

Tuesday, September 01, 2009

Gmail Account Lockdown for 24 hours! Reasons Unknown!

I come across an interesting situation today, while I was going through my emails on Gmail after three daysJ. My Gmail account is locked down for 24 hours without any reasons! That's bad, so anyone have any idea what might be the reason for that.

Friday, August 28, 2009

Google Translate: Web Services written in languages other than English

A utility function that can be used when dealing with web services written in languages other than English that returns value in foreign language like french, even the variable names are in that language and the error messages returned. With this utility function it's very easy to debug the application. Just add this function in one of the utility class in yur project.

string TranslateText(

string input,

string languagePair)


string url =


input, languagePair);

WebClient webClient = new

webClient.Encoding = System.Text.Encoding.UTF8;

string result = webClient.DownloadString(url);

result = result.Substring(result.IndexOf("id=result_box") + 24);

result = result.Substring(0, result.IndexOf("</div"));

return result;


Usage: you can call this function like this

TransalteText(inputString, "ar|en")

It will convert the inputString from arabic to english and return the english text

It will convert the inputString from arabic to english and return the english text

Thursday, July 23, 2009

Silverlight: What is CoreCLR?

Do you know what is CoreCLR? If not then keep reading this article, if yes then do contribute to help others understand it better.

CoreCLR is a scaled version of the original CLR that has been encapsulated within Silverlight2, Don't you think its amazing? Well i find it very interesting, with access to BCL (Base Class Libraries) you can write classic applications using Silverlight2 and now Sliverlight3 coming in with lot more new features.

Silverlight2/CoreCLR includes:

- BCL (though not complete but enough to help you write medium to complex level applications, I'll go in to its details in some other post)
- JIT ( just in time compiler)
- GC ( Garbage collector)

What are the benefits of CoreCLR?

- You have the access to the limited BCL, you can write code in C# or any other .NET language and it will run it User web browser.
- CoreCLR works for non-windows platforms also e.g MAC OS, see below figure. It uses PAL (Platform Adaptation Layer), an API written for different platforms.

Figure taken from MSDN article

- With Silverligt CoreCLR, you can manipulate DOM within C# codebehind of Silevrlight XAML page, or vise versa i.e. using C# objects in JavaScript.
- The good thing about CoreCLR is that its compatible with the original CLR because the designer of CoreCLR have kept the execution engine and virtual machine same.
- You can easily customize the existing code written for original CLR to fit for the CoreCLR but with few changes.
- CoreCLR run side by side with the desktop CLR, that too is a big advantage.
- One of the other great things with CoreCLR is that the Silverlight team has been able to keep the size of the setup in a reasonable range, so that the user don't have to wait that long.

With CoreCLR coming in to picture, its more easy for the .NET developers to write applications in Silverlight instead of using Flash and taking advantage of Action Script in Flash. They need not to learn anything new, they can take advantage of their existing C# or VB.NET skills for writing Silverlight applications business logic.

CoreCLR Web Resources:

- A must read article from MSDN on CoreCLR:
- An interesting Video from Microsoft TechNet 09 about Silverlight2/ CLR, a must see:

Get Microsoft Silverlight

Silverlight Ideas: Making a silverlight application run out of web browser

Here I'm getting started with Sliverlight, learning the architecture, looking at demos,and sample applications.

I come across the details of running a silvelight application, out of IE and to make it a separate application running right from your desktop, just like a Flash application, it will be useful for a completely offloaded application like a single player game, or an online application that can also work in offline and syncroznie stuff when Internet become available.

Here are the details of how to make a Silvelight application to run out of IE.

- Open the Silevrlight Project settings, Right click the project, click on the properties, here you are:

- Click the checkbox, "Enable running application out of the browser", it will enable the settings and will allow a user to run it out of browser.
- You can click on "Out of Browser Settings" button for more customization, like window title, shortcut name, width and height of the window e.t.c. You can even customize the application shortcut icon and that too for different sizes.

- Now the client will see another option i.e "Install on this computer", when he will right click a Silverlight application from within the web browser.

- If you will click on this option it will ask for further details, like "Start Menu", and "Desktop", once done it will install the application.

- Now you are all set to run the application from your desktop or start menu, depending upon the option you selected while installing it.

- You can also remove the application from your desktop if you want to, for that you need to right click when the application is open and selects the "Remove Application" option.

I really liked this idea and the level of customization provided by sliverlight!

Friday, July 17, 2009

PTCL Broadband, not proving to be a wise decision

I got PTCL broadband for home a 1MB link; I thought that it's a good choice at a reasonable cost, due to their student package. Not to mention the hassle of getting it installed at my place it took me a complete month, around 50 reminder calls to their call-centre, with follow-ups to the exchange directly, and the final warning of cancelling my order, it worked though :).

While I was in Pakistan and planning to leave for UK, it worked very fine for couple of weeks and I really loved the speed, but for last couple of weeks it has been a big mess for my family, they come online we start talking and then what happens DSL goes down, they come online again and what now DSL is down again. We hardly talk due to this online/offline thing.

Hats off to their customer service, we have been launching complaints again and again but nothing so far! I wish PTCL as a company can improve their customer service, since now they are not publically owned, if it continues to happen ppl will start looking for alternatives, which I already had!

Tuesday, May 19, 2009

.NET Tricks - alterante folder for project assemblies

Few days back at work i came across a scenario in which i have lot of third party assemblies used by my C# windows application project, i wanted to put them in a separate sub folder instead of the main folder. By putting them in a sub folder it will make my life lot easier when it comes to deployment and other post release stuff.

Luckily .NET framework provides us with a tag in APP.CONFIG where we can specify the alternate folders to look for third party/ shared assemblies. Here is the code snippet that will ask the .NET framework to look into \bin and \shared folder for the shared assemblies instead of just the main folder where the exe is placed.