Running ReportViewer Control on Windows 2000

I’ve been working on an interesting project where we had reporting considerations. I hadn’t been very involved with it. There were some folks creating the reports, some others telling those folks what to do, and still others trying to figure out how to deploy the thing. Needless to say, there were issues with it. So I was asked to come in and see what I could do.

Microsoft has a handy ReportViewer control that really is quite cool. I came from a background where we used Actuate and the report delivery mechanism was a little clunky (probably mostly due to our implementation) and not really integrated at all. So to have this control that basically puts the reports in an IFRAME is kind of cool. It looks integrated at least.

Our environment is a little messed up. I develop on my own W2K3 server workstation and deploy to another W2K3 server. I knew that I had to impersonate a domain user in order to access the required reports. So I followed the instructions I learned here. It all worked fine, until I deployed the solution to an old W2K server, which is our public test machine (don’t ask). I could not for the life of me get it to work.

After many hours trying this that and the other, I finally figured that I *must* be doing something wrong in the impersonation. That’s the only thing that makes sense. So then I came across this. And the solution was so obvious that I felt a little sheepish in announcing my find to others. I don’t know enough about the internals to figure out why it’s happening, but I do know that I’ll consider that I need to grant the “Act as part of the operating system” privilege for the ASPNET user when running on Windows 2000. Hopefully that scenario won’t present itself again.

Strangeness in GridView’s HyperLinkField

Today I got an email from a client who I do some work for. He has an existing application that uses a GridView, probably in much the same way that many others do. There are a few BoundFields and a HyperLinkField. The HyperLinkField looked a little like this:

Pretty standard, right? We see this all the time. And it worked all the time, until we had a “Buyer” who happened to have a colon (:) in her username. It wouldn’t work. There was no error displayed on the page. But there was also no hint of a hyperlink.

I found an article that mentioned this behavior. Apparently it’s to keep your app more secure, so there isn’t malicious stuff thrown in there. In other words, it’s “by design.” So this is what I came up with in its place (the code thing isn’t parsing this properly, no matter what hackery I try):


Another interesting thing is that you have to either remove the EnableSortingAndPagingCallbacks or set it to false. It makes some sense, I suppose, though I won’t pretend to know the exact reason why.

Calling Oracle Packages from C#

I’ve been working on a number of projects that required calling into an Oracle database to get various bits of data. Most of the information was related to product or customer in an ecommerce and/or ERP system. For the longest time, we’ve been relying on an old java listener that just sits there sends and receives sockets. No one is sure how it works, nor are they sure if they even have the latest source code. Everyone is scared that if we pull the latest from VSS and compile it that we’ll have a non-functioning system. They’re probably also wondering if it will even compile.

So here we are in the last few weeks of 2007 and we’re just starting to get going with .NET web services and .NET 2.0. Maybe we’ll even get rid of our old VB6 ecommerce platform (that’s a whole different story). So I found myself needing to create these web services that would call into Oracle and get what I needed. I searched a few places and didn’t find exactly what I needed, so I started with a little trial and error. My packages included CLOBs, so it was a little different. Here’s what I came up with. ProcedureInfo is just an object that holds information about the procedure that I’m calling and my connection to it.

        public static string SendDBRequest(ProcedureInfo pi)
            OracleConnection con = GetPooledConnection(connectionString);
            OracleCommand cmd = con.CreateCommand();

            string clobString = pi.InMessage;

            byte[] clobContents = System.Text.ASCIIEncoding.Unicode.GetBytes(clobString);

            // Get our temporary clob
            OracleClob tempClob = new OracleClob(con);
            tempClob.Write(clobContents, 0, clobContents.Length);

            // Clear the parameters from the command object

            // Set the name of the procedure
            cmd.CommandText = pi.Procedure;
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("result_", OracleDbType.Varchar2, 8000);
            cmd.Parameters[0].Direction = ParameterDirection.Output;
            cmd.Parameters[0].Value = string.Empty;

            cmd.Parameters.Add("result_text_", OracleDbType.Varchar2, 8000);
            cmd.Parameters[1].Direction = ParameterDirection.Output;
            cmd.Parameters[1].Value = string.Empty;

            cmd.Parameters.Add("out_message_", OracleDbType.Clob);
            cmd.Parameters[2].Direction = ParameterDirection.Output;

            // In params
            cmd.Parameters.Add("in_message_", OracleDbType.Clob);
            cmd.Parameters["in_message_"].Value = tempClob;
            cmd.Parameters["in_message_"].Direction = ParameterDirection.Input;

            cmd.Parameters.Add("command_", OracleDbType.Varchar2);
            cmd.Parameters["command_"].Value = pi.Command;
            cmd.Parameters["command_"].Direction = ParameterDirection.Input;


            string detailText = cmd.Parameters["result_text_"].Value.ToString();

            // Get the response from the clob
            OracleClob rtrnClob;
            string clobMsg = string.Empty;

                rtrnClob = (OracleClob)cmd.Parameters["out_message_"].Value;
                clobMsg = rtrnClob.Value.ToString();
            catch (Exception exc)
                clobMsg = exc.Message;



What a year

I’ll save the drama for some other time. Maybe never. Those that have any interest likely already know about it. So here I am, starting over for the 3rd time. It’s been an interesting start/stop thing for me, but now I’m ready to go. I’m not sure what direction this whole venture will go in. I’ve got a few different ideas, and more all the time.

The blog itself will likely serve as my own sort of repository for different things I’d like to keep track of and/or explain (mostly to myself, as it turns out). Perhaps as I get into this, it will expand. I look forward to it. Hopefully others will eventually as well.

Starting Over

It’s time to start anew here. Quite a bit has happened in my life in the last few months, and I’ve been trying to sort it all out and realize where I’m at. I started this post with the intention of laying it all out there, but I don’t seem to have the energy right now.

More later.

IBatis and log4net

I’ve had the fortune of being able to sort of sneak IBatis into the environment at work. I used it in a proof-of-concept type application a few months ago and I just loved working with it. It’s so much better than the MS Application Blocks, and raw ADO.NET. I’ve got built-in caching and other goodies.

One thing that’s just been a mystery to me is the logging of generated SQL statements. I want IBatis to basically log all of its activity so that I can see what’s being sent to the database, what’s being prepared, etc. But for the life of me I haven’t been able to figure it out. I use log4net for all of my other logging and would prefer to stick with that for IBatis. The developer guide seems relatively clear on this, as do suggestions from the user community. But I’m at a loss. I’m going to have to break it down to its simplest form and see what I can come up with.

In the meantime, if any of my vast audience of readers have any suggestions, I’m all ears.

Update: Well, I figured it out. Actually, someone emailed me and told me to give something a try. It was so simple that it’s almost embarrassing to admit, but I’d like to get it out there so I don’t make the same mistake again. All I needed was a reference to IBatisNet.Common.Logging.Log4Net. But of course! Now it’s logging so much that my log file is getting pretty monstrous.

Getting Started

I suppose it’s about time to get things started over here. All of the paperwork is officially . . . official, so I’m good to go. Now to get some stuff off the ground. There are a lot of ideas running through my head, but unfortunately they seem to just stay there and rattle around. I’ll be flushing out some stuff over the next little bit. Hopefully that means some action.