Build of DotNetNuke Custom Module and VS Setting “Only build startup projects and dependencies on Run”

When you are creating DotNetNuke Custom Module(Primary Assembly) in Visual Studio 2003, you are using BuildSupport project responsible for taking the DLL that is created by your project and adding it to the DotNetNuke solution’s bin folder


At the same time for debugging you specify DotNetNuke as the StartUp project for the solution. 


Visual Studio has a “Build and Run Option“ -”Only build startup projects and dependencies on Run”.
Ensure that is not ticked.(Unfortunetely the option is global for Visual Studion and can’t be set differently for different solutions)


If the option will be on, DotNetNuke project will start without rebulding of the Private Assembly and latest changes will not be included.


It seems that Visual Studio 2005(not tried yet) has other options to solve the problem

Advertisements

DirectorySearcher.FindAll() -should have PageSize=1000

When you are calling DirectorySearcher.FindAll() and there is  a chance to have more than 1000 records back, you must set PageSize to non-zero value, preferably 1000. Otherwise only the first 1000 records will be returned and other entries will be missed without any warning.

The names of DirectorySearcher members  and documentation is quite messy. FindAll() method should return ALL records, not the first 1000. Setting PageSize doesn’t mean that you get back only single page, but triggers returning of the values into “page size” chunks transparently to you in the background. If you set SizeLimit to a value that is larger than
the server-determined default of 1000 entries, the server-determined default is used.

Thanks to Joe Kaplan’s post that finally helped to find solution.

I have a simple program that imported AD users to application database. It was tested and worked fine on a few sites.

However one of our customers complained that some users were missed during import when others were imported successfully. No pattern was found what is the difference between imported and missed user accounts.

After some investigation it was noticed that only 1000 records are returned by DirectorySearcher.FindAll.  Ok, documentation describes DirectorySearcher.SizeLimit with default value is zero, which means to use the server-determined default size limit of 1000 entries. I’ve changed SizeLimit to 100000, but it didn’t help -still only the first 1000 was returned. 
Reading further, I found that the server-determined default is used so SizeLimit is useless, if you expect  big number of results. In a few posts I found how to change the default value on the server, but there were also recommendations not to change server setting, but use paging instead. OK but how to use paging? I’ve started to search for code examples, expecting that some complicated coding will be required.

Finally  Joe Kaplan’s post explains that only code change that required is
PageSize=1000
and all paging will happen in background.

MS should have better  DirectorySearcher documentation and implement background paging by default.

COMException (0x80004005): Unspecified error] in DirectorySearcher.FindAll() means LDAP string is invalid.

I’ve got an error COMException (0x80004005) when called DirectorySearcher.FindAll() and had no idea, why it happened.


Thanks to DirectorySearcher.FindAll() causes Unspecified Error in C# but not in VB.NET discussion I was pointed, that


the error is shown if DirectorySearcher.SearchRoot  path is not valid, e.g. it is “DomainName” instead of “LDAP://DomainName“.


I beleive MS could provide more clear error description.


 

Resolved :.NET Runtime version 1.1.4322.2300- Setup Error: Failed to load resources from resource file


On a windows 2003 server (IIS6) from some time when I tried to open ASP.NET application I started to receive error:


.NET Runtime version 1.1.4322.2300- Setup Error: Failed to load resources from resource file.Please check your Setup.


and was unable to do anything. In the Sitem event log ther was related warning from W3SVC:


A process serving application pool ‘Pool1’ terminated unexpectedly. The process id was ‘2648’. The process exit code was ‘0x800703e9’.


The google shows many reports(e.g www.dotnet247.com/247reference/msgs/34/174172.aspx)  with the same error but not much resolutiuons.


I beleived that the error started after I’ve installed remote debugging components for .Net 1.1. So I’ve uninstalled remote debugging components from the machine, but it didn’t  help. 


Then I’ve install all windows Servcie Packs/Updates -no changes to my problem.


On web I found an advice to install “Debug Diagnostic Service” -it didn’t stop on the error and didn’t produce any logs.


I’ve install full version of VS 2003 and it allowed me to debug Stack Overflow exception.


The stack traced showed that SecurityException was thrown recurcively by dnvexceptionhandler.dll!net.nvisionsoftware.AppVisionSLM.ExceptionWrapper.


I found that DotNetWindows VAT (Vulnerability Assessment Test)  from nVision Software Technologies was installed. I’ve uninstalled it but the same error still occurred.


I found that even after uninstall folder C:WINDOWSNVisionInstrumentationConfig still existed and dnvexceptionhandler.dll was still loaded by w3wp.exe.


Only when I manually renamed  C:WINDOWSNVisionInstrumentationConfig  folder , the error disappeared.


Hurray!


 


 

One more Calendar Popup Custom Control.

I needed an Calendar Popup Control that is not cut off, if located near the the bottom of visible part of the browser window.


See my implementation based on  Matt Kruse JavaScript Calendar Popupcontrol (PLEASE SUPPORT HIS SITE)

Calendar Popup Custom Control

I have to maintain existing ASP.NET application that used eWorld.UI.CalendarPopup custom control to show calendar in a small popup window.

The users complained that the popup window not always rendered correctly if shown in front of other controls and if the control is on the bottom of visible part of the browser window, most of popup calendar is cut off.

I’ve tried to download the latest version of the eWorld.UI.CalendarPopup  and found that it is currently not available.

I’ve tried a few free controls from http://www.411asp.net/home/assembly/datetime and from http://weblogs.asp.net/datagridgirl/archive/2004/02/05/68105.aspx

but most of them do not position well when the contol is located near the bootom of the page.

Finally I found Matt Kruse JavaScript Calendar Popup control (PLEASE SUPPORT HIS SITE) that works as it is required.

I’ve created an ASP.Net custom control as a wrupper to Matt’s JavaScript to make it easier to include in ASP.NET pages.

My custom control has only a few properties that I needed and doesn’t expose all options that Matt’s JavaScript allowed.

If required it can be extended.

      ///

      /// DatePicker -one more attempt to do the same things

      /// it’s ASP.NET wrapper for Matt Kruse Calendar Popup http://www.mattkruse.com/javascript/calendarpopup/index.html

      /// I had to replace eWorld.UI.CalendarPopup

      ///

      // TODO : if the control is in the frame, it can position far below the parent control (see DSPAddSchoolInfo)

      [DefaultProperty(“Text”),

            ToolboxData(“<{0}:DatePicker runat=server>”)]

      public class DatePicker :  Control, INamingContainer 

      { //,IPostBackDataHandler

            //private string m_text;use ViewState instead

            public DatePicker() : base()

            {

            }

            #region   “Private properties”

            private TextBox m_txtDate;

            private HyperLink  m_lnkSelect;

            #endregion  // “Private properties”

 

#region   “Public properties”

           

            [Bindable(true),

                  Category(“Appearance”),

                  DefaultValue(“”),

            EditorAttribute(typeof(System.Web.UI.Design.ImageUrlEditor), typeof(UITypeEditor))]

            public   string ImageUrl 

            {

                  get

                  {

                        this.EnsureChildControls();

                        return m_lnkSelect.ImageUrl;

                  }

                  set

                  { 

                        this.EnsureChildControls();

                        m_lnkSelect.ImageUrl = value;

                  }

            }

 

            [Bindable(true),

            Category(“Appearance”),

            DefaultValue(“”)

            ]

            public  string Text

            {

                  get

                  {

                        return TextBox.Text;

                  }

                  set

                  { 

                        TextBox.Text = value;

                  }

            }

///

/// Property TextBox (TextBox)

///

public TextBox TextBox

{

      get

      {

            this.EnsureChildControls();

            return this.m_txtDate;

      }

      set

      {

            this.EnsureChildControls();

            this.m_txtDate = value;

      }

}

            [Category(“Data”), Bindable(true)]

            public DateTime SelectedDate

            {

                  get

                  {

                       

                        if (DataHelper.IsNullOrEmpty(TextBox.Text)==false)

                        {

                              return (DateTime) Convert.ToDateTime(TextBox.Text) ;

                        }

                        return new DateTime();

                  }

                  set

                  {

                        TextBox.Text = value.ToShortDateString() ;

                  }

            }

 

            private const  string  cnstJavaScriptUrlName  = “JavaScriptUrl”;

            ///

            /// ViewState Property JavaScriptUrl

            ///

            public string JavaScriptUrl

            {

                  get

                  {

                        return  (string)ViewState[cnstJavaScriptUrlName];

                  }

                  set

                  {

                              ViewState[cnstJavaScriptUrlName] = value;

                  }

            }

            #endregion  // “Public properties”

 

            ///

            /// Overrides

            ///

            protected override void OnLoad(System.EventArgs e)

            {

                  base.OnLoad(e);

                  this.EnsureChildControls();

                  InitCalendarPopupControl(this.m_txtDate,this.m_lnkSelect );

            }

 

            protected override void CreateChildControls()

            {

 

                  m_txtDate = new TextBox();

                  m_txtDate.ID=”txtDate”;

                  this.Controls.Add(m_txtDate);

                  m_lnkSelect = new HyperLink();

                  m_lnkSelect.ID=”lnkSelect”;

                  this.Controls.Add(m_lnkSelect);

            }

            protected void InitCalendarPopupControl(TextBox txtDate,HyperLink  lnkSelect)

            { //from http://www.mattkruse.com/javascript/calendarpopup/index.html)

                  Page page=txtDate.Page;

                  string sClndrId=”clndr”+txtDate.ID;

                  string sDecl=”var ” + sClndrId + ” = new CalendarPopup();”;

                  page.RegisterStartupScript( sClndrId,JScriptHelper.JScript(sDecl));

                  string srcPath=JavaScriptUrl;// “~/js/CalendarPopup.js”;

                  if(DataHelper.IsNullOrEmpty(srcPath))

                  {

                    srcPath= ResSrvHandler.ResourceUrl(“CalendarPopup.js”,true );  

                  }

                  JScriptHelper.RegisterStartupScriptUrl(page,srcPath);

                  string sJScriptSrc=@”
<script language="" src=" + page.ResolveUrl(srcPath) +  “>
“;

                  page.RegisterClientScriptBlock( “CalendarPopup.js”,sJScriptSrc);

                  //          “cal.select(document.forms[‘example’].date1,’anchor1′,’MM/dd/yyyy’); return false;”

                  string sInvokePopupCal=sClndrId+”.select(document.forms[0].” + txtDate.ClientID + “,'” + lnkSelect.ClientID  + “‘,’dd/MM/yyyy’)”;

                  page.RegisterStartupScript( sClndrId,sDecl);

                  //very similar to DNN C:Visual Studio ProjectsFuncSolnFSDNNcomponentsSharedCalendar.vb

                  lnkSelect.NavigateUrl=”javascript:” + sInvokePopupCal;

            }

 

 

      }