Tuesday, 12 February 2008

IIS Asp.Net (Apparently) Bizzarro (turns out) lack of understanding

Had apparently strange goings on with IIS & Asp.Net.

Delivered new mylibrary.dll. User renamed mylibrary.dll to "old mylibrary.dll", copied in new mylibrary.dll. Got error saying 'old mylibrary.dll' could not be loaded into manifest.

After deleting the 'old mylibrary.dll' files the web site loaded ok.

After a discussion we came to the conclusion that IIS loads all the DLL files in the BIN directory irrespective of references within Web.Config.

The site then throws exception when two dlls contain the same Assembly-name - this also makes sense.

So what appeared to be strange behaviour came down to not thinking logically!

Monday, 4 February 2008

Asp.Net Ajax Calendar Extender

There is a bug with the AJAX calendar extender in that the style of the popup calendar are not applied if the text-box /calendar extender are hidden when a page first loads.

e.g. Panel with Details on is only shown once valid record found; if the first calendar extender on the page is within this hidden Details panel the calendar will not be displayed correctly when Details does become visible:

image

To fix this have a hidden calendar extender at top of the page:

<!-- Workaround for Calendar not displaying correctly - if hidden when page first loads -->
<div style="display: none"><asp:TextBox runat="server" ID="textbox1" /><cc1:CalendarExtender ID="ceTextBox1" runat="server" TargetControlID="textbox1" /></div>


Calendar is then displayed correctly:



image

Monday, 28 January 2008

Crystal Reports Asp.Net issues

Deployed Crystal Reports to server by:

Run CRRedist2005_x86.msi (taken from C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports\)

Icons did not display in CR Toolbar:

Copy C:\Inetpub\wwwroot\aspnet_client to root of website)

 

ADO provider not found (SQL Server 2000):

Report (design-time) connection was SQL-Native changed to be SQLOLEDB.

 

Change connection information at run-time

                CrystalDecisions.Shared.TableLogOnInfo tliCurrent;
                foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in crSource.ReportDocument.Database.Tables)
                {
                    tliCurrent = tbCurrent.LogOnInfo;
                    tliCurrent.ConnectionInfo.ServerName = server;
                    tliCurrent.ConnectionInfo.UserID = username;
                    tliCurrent.ConnectionInfo.Password = password;
                    tliCurrent.ConnectionInfo.DatabaseName = dbname;

                    tbCurrent.ApplyLogOnInfo(tliCurrent);
                }

 

Toolbar Not working

The toolbar options were not working because a post-back was being generated that performs the functionality - the assigning of the report was within a !IsPostBack block. As the report is not held in state it must be reloaded during post back.

Monday, 21 January 2008

NHibernate transaction locking oops!

Was testing catching NHibernate.StaleObjectStateException (exception where one user updates a record which another user then attempts to update without getting newer version).

Was getting 'Failed to initialise lazy..." when reloading record on associated collection due to a timeout and also appeared to be locking the server (no queries could be run on tables involved in failed update)

It came down to the transaction not being Rolled-back when exception thrown - so obviously DB still in transaction.

Monday, 26 November 2007

Databinding NHibernate

Had a few problems data-binding lists returned from NHibernate (queries or collections) where the first object in the list was a proxy. We previously 'fixed' this by clearing the session prior to running the query. This then caused further problems as objects were detached and the lazy-lists threw exceptions.

The solution we came to is based on : This posting by Ayende

A TypeDescriptor was created for EntityBase (all our objects returned from NHibernate inherit from EntityBase) which was registered with the web-site in the Global.asax Application_StartUp.

Thursday, 22 November 2007

Configuration Error: FairmortRoleProvider

When creating a new site we kept getting spurious errors which seemed to relate to "add name=FairmortRoleProvider...." line of Web.Config.

This was a red herring and the actual error related to Spring Config files and references.  The Salecore assemblies that are to be referenced must be added as a reference AND the relevant config files also added. Either missing reference or config file can cause this spurious error.

Thursday, 25 October 2007

VS2005 not rebuilding project

Had an issue with a specific project not being rebuilt when changes made to it and web site being run. The solution contained multiple projects and none of the other projects exhibited this behavior.

 

Appears due to Project being marked as not rebuild for Solution, although this setting was not turned on manually.

Setting access via: Solution (right-click) Properties -> Configuration.