Archive for category .Net
Note that the latest Crystal reports version is no longer in beta, this is a good video to help you get past the bumps of installing and getting it to work for the first time in .Net 2010:
You can ignore the instructions on how to get the download from their site as a couple of the steps are wrong (their site has changed since the video was made).
As of March 2012 get Crystal Reports for Visual Studio 2010 Download here
As of (June 22, 2011) it was available here (Still a useful page, especially if the new link goes dead. You know it will) Crystal Reports for Visual Studio 2010 Download here.
Well it seems the good people at Crystal have been dragging their feet a bit in releasing a new version for Visual Studio 2010. I recently downloaded the beta version of Crystal for Visual Studio 2010, if you’re interested you can get it here:
I installed it on my machine and was having some good success, that is until I tried to run it the first time. It seems there is a bug in it that requires this attribute be added to your app.config / web.config file:
Which has something to do with a change Microsoft made in .Net ver 4.0 that Crystal failed to handle before their release.
So after that one little hiccup I completed development of my project and all was well, which I thought wasn’t too bad for a beta version of software, that is, until I tried to deploy my change.
It seems the Crystal runtime has bloated a bit, it’s now 1gig+ and takes forever to install (over an hour on my clients’ machine). Finally I had it and my app installed I then went to run my new app annnnddd.. crash. Dang it. It turns out that the beta version of the Crystal install does not support being installed on a machine that already has a previous version of Crystal on it, no matter what version.
So I tried uninstalling versions, re-installing versions, uninstalling versions on my machine, re-installing only the 2010 version and re-building. No matter what I tried I could not get my report to run on my clients machine.
At this point I have no idea what the issue was, whether I was deploying it wrong, if the runtime installer for Crystal is broken, or if it’s something else entirely, but at this point if you’re interested in trying out Microsoft.Reporting.WinForms.ReportViewer I highly recommend it!
Ultimately I wound up using Microsoft’s Reporting engine, which I have to say was a delight to work with. It has its own little oddities, but the first time I ran it, the FIRST time, it worked like a charm.
Thanks MS, sorry Crystal, you just lost a customer.
There’s a interesting site out there with a number of windows example code samples. They are ‘shell integration’ examples, it looks interesting.
There are a number of things that can time out in a webservice so this question has a few parts to it. Among the things that can time out the main ones are:
1) The client making the call (your web app for example)
2) The webservice itself (by default a web method has a max run time set by the web.config / IIS)
3) Generally timeouts are related to database calls that take too long. Your data call can time out getting data from the database.
Now generally you shouldn’t be extending timeouts if your app is taking too long to run. If your app is timing out chances are your app is doing something wrong and is simply too slow. Perhaps you should put the long running process on another thread? Or improve your SQL? Or maybe it actually is a hardware / network bottle neck. The best reason I can think of for wanted to extend the timeout on a web-service is when you are in debug mode and having the service timeout during debugging is annoying and time wasting.
In any case, if you do genuinely need to extend the timeout for a web service add this to your web.config:
<httpRuntime executionTimeout=”600″ />
This node is a child of <system.web />
Here’s a topic that’s integral to programming, but I doubt there’s a developer out there that has them all memorized, datatypes. Different languages / data storage applications have different datatypes. Often they’re not even compatible with each other so marshaling data from database to user interface and back again can be a challenge.
I’m going to keep a list of links to datatype definitions here, if you have one you would like me to add be sure to leave a message!
Datagrids – how to filter / sort
This topic has been done over and over and over again. The thing is, it always seems like I’m trying to make the datagrid do something I’ve never done before on every project I write.
There are a few steps to getting the currently logged on user in a web app. First there is the code, which is quite simple. This is it:
Dim userName As String = My.User.Name
String userName = this.User.Identity.Name
There is some detail on this page as to how to parse out just the name from the domain:
http://vbdotnetforum.com/index.php?/topic/411-get-username-of-logged-on-user/, though you really shouldn’t do this. In a properly constructed organization if there are multiple domains, say domain1 and domain2 then these users:
are not the same person. So using just the name without the domain is invalid logic.
Now that you have the code to get the current user you may find that it always returns an empty string, “”. If this is occurring it means that your website is not properly passing integrated windows authentication information to your app. This won’t happen in a fat client application but is likely to happen in a web app.
To enable authentication in your development environment change the authentication mode to “Windows” in your web.config like so:
This node is a child of <system.web> in vs2010.
Deploying this app to IIS should result in Windows authentication, as per the app.config file, if not the steps to configure a Virtual Directory are:
Open IIS admin-> Find your Virtual Directory->r-click on it->Properties->Directory Security->Under the heading “Anonymous access and authentication control” click Edit->Uncheck “Anonymous access”, check “Integrated Windows authentication”.
That’s it, happy integrated auth!
It turns out there are a number of headaches involved in getting integrated auth to work when calling from a windows form app to a webservice. For the life of me I couldn’t get a VS2010 app to call a website hosted on an older version of IIS. I imagine this is an issue with IIS being out of date, but seriously. Integrated Auth has been around for ages, there HAS to be a way.
Anyway, I digress. It turns out not everything implements IPrincipal so you can’t always use this.User to get the user. If that doesn’t work there are these options as well:
If you know how to get VS2010 to call a webservice hosted on IIS 4 using integrated authentication be sure to let me know.
I’ve been having quite the time recently getting old code, old Oracle databases and old Oracle database drivers to work alongside new code, new databases and new database drivers. Some of the issues I’ve had are:
1) Microsoft wrote a oracle driver for .Net which they have now deprecated
2) Oracle doesn’t seem willing to allow downloads of version 9.x from their website, if you can figure out where to download it from, let me know.
3) .Net 2010 needs a recent version of the Oracle driver (around ver 126.96.36.199.2) to replace the now deprecated Microsoft one. Unfortunately when installed the new driver won’t connect to old databases. Most of the databases I use are recent, but there is one I can’t connect to with 11.x
4) Oracle used to use a Oracle_Base folder to tell a machine what the default version of Oracle on it was. They seem to be moving away from this approach but the old base dir still haunts. My old VB6 apps for example are stuck in their ways and won’t use anything but the base version.
There’s more, but I’ll leave it at that for now. Finally I found some details on how I can make this nightmare a little less frightening. Firstly make Oracle 9.x the “Base” version, then in your .Net apps you can specify what version to use. To do this modify your web or app config files, add this XML just before the closing </configuration> tag:
<oracle.dataaccess.client> <settings> <add name="DllPath" value="C:\ORACLE\Base\product\188.8.131.52.2\client\bin"/> <add name="FetchSize" value="65536"/> <add name="PromotableTransaction" value="promotable"/> <add name="StatementCacheSize" value="10"/> <add name="TraceFileName" value="C:\ORACLE\Base\product\184.108.40.206.2\client\odpnet2.trc"/> <add name="TraceLevel" value="63"/> <add name="TraceOption" value="1"/> </settings> </oracle.dataaccess.client>
Note: the paths have to be valid for your machine.
To make this process even easier, instead of modifying your web or app config you can modify your machine config. This will affect all .Net apps written for a given .Net version. EG modify this file:
With the same method mentioned above. Now all 4.0 .Net apps will use that Oracle version by default. They can still override that by putting a different one in their app or web config.
More info on managing Oracle installations can be found here: