All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.

TechTidBits (Blog)

SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Oct10

Written by:Friday, October 10, 2008 12:30 AM

Using a GridView with ObjectDataSource or SqlDataSource, parameter setting results in Page Not Found error in IIS but works perfectly on Vista?

Are you using a GridView with either ObjectDataSource or SqlDataSource, setting a parameter(s) and getting a Page Not Found error in IIS but working perfectly on your dev box (most likely Vista)? If you are, I think I can help you!
If you're deploying your code to IIS 6.0 with .NET 2.0 and you get a Page Not Found Error, take a look at the Event Log and look for some Warnings. Do they look similar to this?

There will be some extra stuff around it, but this is the meat, ALSO the method signature could differ depending on the code you have to set the parameter's value. If this is the case, take out the setting of the DbType property! Try it out, this worked for me! :>
This one is VERY hard to diagnose cause the failure effect is a 404, Page cannot be found in IE. WTF? And worse yet, there's VERY little help on the web right now. Hence this blog to help spread the word.

NOTE: I wonder if I install .NET 3.5, if this problem will still be around?

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thank you so much for this, it helped me solve a similar problem. I was getting the usual ASP .NET error page with a MissingMethodException, not the PageNotFound error, but this solution worked.

By Pedro Carvalho on Wednesday, November 19, 2008 9:43 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Glad I could help, that's what I was trying to do, to help out! Have a good one! :>

By phenry on Wednesday, November 19, 2008 9:44 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

This worked for us too.. Thanks. In our case we attempted a build on 3.5 and reverted to 2.0, I've checked every reference and nothing refers to .net 3.5, however it seemed to still be a problem. Once replaced dbtype to TypeCode.String it worked.. Thanks.

Anyone know why this has occurred.

By Mike on Friday, November 21, 2008 5:34 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

I wasn't going to enter this blog in the first place thinking people aren't running into it, but I'm glad I did! :>

Not a problem, this is turning out better than I first anticipated! I was just hoping to help one person, but I've helped two on this one! :> haha Double my expectations (ok, so I have low expectations :>), but seriously, I'm glad I could help out and that you were able to figure out your issue and move on! :>

By phenry on Friday, November 21, 2008 5:36 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thanks for this. Helped me out too.

By John McArthur on Monday, December 15, 2008 10:09 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Glad I could help John! Very cool! I do hope the subject line helped it come up in Google/Microsoft search? I tried to craft it that way. Thank you very much for leaving me a note as well! Much appreciated, have a good one!

By phenry on Monday, December 15, 2008 10:10 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thank you for this! That's a very weird bug and I'm sure if you hadn't written this article I would have spent many hours trying to solve the same thing!

By Adam Lofting on Tuesday, January 13, 2009 3:02 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

No probs Adam, my pleasure and thank you for posting a comment! I love it when I'm able to help people out! Ya, this one is a nasty one and glad I could help! Take it easy and I hope you come back for more info in the future.

By phenry on Tuesday, January 13, 2009 3:02 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

You are a life saver. My technical skills are pretty good, but I would have never figured this out (in time). Thank you very much. Why can't all those hackers out there use their time as wisely as you do? Go figure.

By Larry on Thursday, January 22, 2009 11:34 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thank you very much! DAMN! I'm glad I could help out so many people! I love this! I'm like you Larry (the pretty good tech skills I mean :>). As for using time wisely? hahah :> My partner might disagree with you on that one haha :> but it's something I love doing! Take care and I'm glad I could help, I hope you keep reading for other interesting things and comment on them too. :>

By phenry on Thursday, January 22, 2009 11:37 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thank you! I had the same error. You have saved me a lot of troubleshooting. I guess it will be more and more coomon for developers to be using Vista. This blog entry is a keeper!

By Jeremy Larter on Monday, February 09, 2009 8:25 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thanks for dropping by and leaving me a note Jeremy! Much appreciated. As I've mentioned before I love hearing from people I've helped out! :> I hope I can continue doing it! :> Keep up the great work! :>

By phenry on Monday, February 09, 2009 8:26 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

thanks Peter! right before i picked up a gun and went postal i found this blog. you saved someone from severe water torture.

By Nate on Saturday, April 18, 2009 12:54 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

I'm VERY glad I was able to help out Nate. Wouldn't want someone to go postal nor sucomming to water tortuer! :> DOH! :> ahha I've been there! (WebLogic and trying to get my JSP page to see my MySQL db and return back data, not fun neither).

Glad I could help and thank you very much for sharing your experience (good'n'bad). I hope you come back for more. :>

By phenry on Saturday, April 18, 2009 12:56 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

I am NOT using Vista, but I ran into this problem too. The wierd thing is that everything was fine on my dev machine, but broke down when I published.

Thanx!

By Steve on Monday, May 11, 2009 9:45 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thanks Steve for posting a comment! I had the SAME prob, worked on dev but not on IIS when I published it. :< Frustrating eh? I'm glad you found this blog, I hope it helped early enough (before you pulled out too much hair)?!

By phenry on Monday, May 11, 2009 9:47 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thank you so much, i had this problem on XP ! I remove the DbType and everything worked fine.Good job

By Fabien on Thursday, June 04, 2009 9:50 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

My pleasure Fabien! :> Glad I could help out! I remember FIGHTING with this for a few nights and it was driving me CRAZY! I hope you found this link shortly after finding the problem? Take it easy.

By phenry on Thursday, June 04, 2009 9:51 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thanks a lot! I was able to solve my problem by swapping DbType.xxx to TypeCode.xxx. I didn't find your post directly, cause I was googling for "'Void System.Web.UI.WebControls.Parameter..ctor(System.String, System.Data.DbType, System.String)".

I don't understand how this problem can occur though. How can it be that this code runs just fine on my dev machine? My project is created in VS2008, but the project is targetted at .Net Framework 2.0. So how is it possible that the code runs just fine on my dev machine (both in ASP.NET Development Server as on the locally installed IIS 5.1)? Does it mean the code isn't using the 2.0 version but is using 3.5 instead? Or does the 2.0 version of the webcontrols dll get overwritten by a new version when installing VS2008? Or more precise, is the 2.0 version of .Net that gets installed as part of .Net 3.5 another version than the original 2.0 version?

Also, the help file of Visual Studio 2008 does not include the DbType.xxx version of the Parameter constructor, but IntelliSense does!

So this means I have to test my .Net 2.0 apps on a machine with .Net 3.5 installend and also on a machine with .Net 2.0 installed? Thank you very much Microsoft...

By Dick Nagtegaal on Tuesday, July 07, 2009 8:08 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thank you Dick for leaving the comment, sorry I wasn't help to help out sooner. I added your search string to the blog entry, hopefully it'll come up on someone else's google search next time.

re how can this occurCause MS pulled out some functionality in one ver of the CLR and replaced it back in in a subsequent ver. I don't have the specific numbers in front of me, but I think it was the 2.0 they pulled it out of, which is why it works on your dev box (probably using 3.5 right?) but your IIS 5.1 is probably using 2.0 which I think (if memory serves me correctly but I'm going on one coffee haha) doesn't have that support.

You shouldn't need to retest on different vers of the CLR, at least you shouldn't need to. This is ONE and my first hiccup like this I've encountered, so although it's wise to be aware of this, it's not something to start requesting budgets and staffing up new departments to test for. haha

Hope you have a good one!

By phenry on Tuesday, July 07, 2009 8:16 AM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thanks a lot! I was able to solve my problem by swapping DbType.xxx to TypeCode.xxx. I didn't find your post directly, cause I was googling for "'Void System.Web.UI.WebControls.Parameter..ctor(System.String, System.Data.DbType, System.String)".

I don't understand how this problem can occur though. How can it be that this code runs just fine on my dev machine? My project is created in VS2008, but the project is targetted at .Net Framework 2.0. So how is it possible that the code runs just fine on my dev machine (both in ASP.NET Development Server as on the locally installed IIS 5.1)? Does it mean the code isn't using the 2.0 version but is using 3.5 instead? Or does the 2.0 version of the webcontrols dll get overwritten by a new version when installing VS2008? Or more precise, is the 2.0 version of .Net that gets installed as part of .Net 3.5 another version than the original 2.0 version?

Also, the help file of Visual Studio 2008 does not include the DbType.xxx version of the Parameter constructor, but IntelliSense does!

So this means I have to test my .Net 2.0 apps on a machine with .Net 3.5 installend and also on a machine with .Net 2.0 installed? Thank you very much Microsoft...

By Dick Nagtegaal on Tuesday, July 07, 2009 7:34 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Howdy Dick, I think something happened but you're message is duped from this morning to this evening. Was that on purpose?

By phenry on Tuesday, July 07, 2009 7:37 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

No, that was not on purpose. You can just remove the second entry (your and my reply).

By Dick Nagtegaal on Friday, July 24, 2009 3:49 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thanks! this really saved my day..... Changing DbType for TypeCode worked for me too! I could have been hours and hours trying to figure this out!

By Mery on Wednesday, August 26, 2009 9:14 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thank Mery for leaving a comment letting me know this "fix" worked for you! Glad I could help and that you figured it out, awesome! I hope my site comes up as potential fixes for other issues you might run into in the future (I run into a lot of them and try to blog about them hahah). Have a good day.

By phenry on Wednesday, August 26, 2009 9:16 PM

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?