Paul Speranza's .Net Life

Life with .Net

February 2004 - Posts

NUnit tip for ConfigurationSetings.AppSettings

Today I had to unit test a dll that will read the web.config file from my web app. Here is the setup

     MyUnitTester

           TestSettings (Tests GetSettingsFromKey)

     MyBusinessObject

           GetSettingsFromKey

I never had to do this before so I read the NUnit PDF and it actually turned out to be quite simple.

  • Copy the web.config file that you will read into the bin\debug directory of the test project.
  • Look for a file with the .nunit extension (should be the same name as the test project's dll)
  • Rename the web.config file to the same name as the nunit file but change .nunit to .config.
  • Run your tests.

 

 

 

A question about built in Oracle security

I have a web app that needs to work with a PowerBuilder app's database. This means sharing tables for user rights and other such things. The PB app uses Oracle's logons so the user id and password are passed in the connection string. To authenticate a user they are telling me to get the id and password and try to connect to Oracle and trap an Oracle exception if the connection fails because of invalid credentials.

Is there a better way to find out if the user is valid in the Oracle database? Our current database has our own table for  users so this is not an issue in the web app, but we are combining databases and would like to have the PB app maintain users, which means my tables wil go away. We don't want to maintain two ways of logging on.

Any suggestions?

Do MS uninstalls really uninstall?

I want to share two adventures which I would have thought were totally unrelated that I had recently in the hopes that I can save someone else some pain.

I have been studying for the C# Web app cert using Amit Kalani's book on my laptop. My first adventure started with creating a data form wizard. It worked up to the point after I selected a table and tried to pull the columns back. Here is the post I sent to the microsoft.public.vsnet.ide newsgroup.

I am trying to use the Data Form Wizard against the
Northwind database in SQL Server. After I select a table
and click next I get the following error

---------------------------
Error
---------------------------
The following error occurred:"Value cannot be null.

Parameter name: type"
---------------------------
OK  
---------------------------

This happens with any database. Any ideas?

An MS support person really tried to help for over a week but I got nowhere so I let it go after trying everything he said, right down to reinstalling Visual Studio (what a pain in the ass that is). I ran it on another machine at work and was able to do the section in the book. Since I don't intend on using the wizard I wasn't too concerned since it was the only problem I had with VS.

Next I'm doing the web services chapter and I can't add a web reference. So I spend a whole night googling, searching MSDN and just about every thing I could think of but got nowhere. Here is the error I was getting.

The 'type' attribute must be set to a valid type name. (C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe.config line 33)

I look at devenv.exe.config and don't see anything wrong. Now I'm getting nervous. Is my laptop whacked out? Could there be a VS .Net specific virus? Two problems back to back? I post up to the microsoft.public.dotnet.framework.aspnet.webservices newsgroup and finally go to bed at 2 am totally defeated for the night. The next day I go to work and check this out on 2 machines at work. Guess what - their devenv.exe.config files did not contain the following section:

 <system.web>

<webServices>

<soapExtensionImporterTypes>

<add type="WseSettings.WseExtensionImporter, WseSettings, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=6c8e35098ebaa666" />

</soapExtensionImporterTypes>

</webServices>

</system.web>

Then I get it - I had installed WSE but uninstalled it. Stupid me, I should have known that didn't belong in there. (yeah right) So I comment out the section and viola, I can now add a web reference. Like a good citizen I posted back to my original post, which still had no reply this early, with the solution.

So then I say to myself, "self - could this possibly fix the data form wizard? After all, it does have something to do with the dev environment and every thing in VS is based on XML and config files."  So I run the dataform wizard without a hitch. Bingo! And, yes, I posted this solution also in a reply to my earlier post.

So my point is what the hell is the sense of an uninstall if it doesn't unistall everything? If I run the uninstall that means I want it gone. And if they absolutley insist on saving me from myself, then at least tell me that some files or reg settings are still there so I can clean them out after backing them up if I want. The MS uninstalls are the only ones I can remember that do this. Am I nuts or has anyone else seen this?

 

 

 

 

 

Configuration Settings

I am looking to have my business rules dll read a key from the web config file using ConfigurationSettings.AppSettings. So far my dll which is shared by two test apps seems to get the right value depending on the calling app. Are there any issues doing this?  I had the settings in the registry but now we are going to have two or more web apps using the library so I want to read a key out of the config file. I don't want the apps to have to pass this to the dll.

 

 

More Posts