Friday, August 24, 2007

Dynamically / programmatically changing connection strings of ASP.NET 2.0 providers at run time

Recently, I've been using .NET web parts and personalization on a project. I am pretty happy with the drag and drop feature and how the personalization works, until I was required to change the connection string of personalization database (Application service database) dynamically on run time, instead of declaring it on web.config. Took hours to find a solution or reference to the issue. Finally, found it out in Scott Gu blog, source code for the built in providers in ASP.NET 2.0, what a relieve!  You can check it in here http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx

So I modify the source code a bit, recompile and change the type of provider in the config file and jobs done.

Monday, August 13, 2007

IE7's absolute positioning problem when overflow is auto

Recently, I was faced with a weird absolute positioning problem that only happen in IE7. Basically, I have several span tag with absolute position inside a div tag with "overflow:auto", it displays correctly in IE6 and Firefox 1.5 onwards, the object was positioned perfectly. The problem arise when one of our customers upgraded their browser to IE 7 and reported the problem, where text appear all over the places. "The problem doesn't happen until we scrolled further down to the div area wasn't visible initially."  It was quite some time to discover the cause of the problem, pasting the HTML to W3C mark up validator (http://validator.w3.org/) and no problem found. I tried to change the overflow from auto to "overflow:scroll" and the problem gone.

I finally ended up setting a different style for IE7, there is a good reference on how to set CSS to specific browser http://www.webdevout.net/css-hacks#in_css-hyphen.

Anyway, if you have a problem with web page's positioning and it only happen in IE7, it worth to try the solution above and hopefully the problem goes away.

Wednesday, February 01, 2006

BC30251 has no constructors

Finished developing and testing on the local machine (XP), I uploaded the latest change to the staging server running windows 2003, using the web deployment add in for VS 2005. Try to test the application an error is thrown advising that one of the user control doesn’t have a constructor. The error code was BC30251. Find the reference: http://msdn2.microsoft.com/en-us/library/s6zx0et2.aspx

A type does not support a call to Sub New(). One possible cause is a corrupted compiler or binary file.

Error ID: BC3025

To correct this error

1. If the type is in a different project or in a referenced file, reinstall the project or file.

2. If the type is in the same project, recompile the assembly containing the type.

3. If the error recurs, reinstall the Visual Basic compiler.

4. If the error persists, gather information about the circumstances and notify Microsoft Product Support Services.

Tried to recompile the application and redeploy it again doesn’t work. I tried to avoid as much as possible to reinstall the .NET framework or VS 2005. I commented few lines of code inside the user control, try again to deploy in the same way, and it worked! Finally, I moved few lines of code to other utility (helper class) and the application went perfect. Just another fun thing with new stuff .