Request a topic or
contact an Arke consultant
404-812-3123
All posts by trenton adams

Arke Systems Blog

Useful technical and business information straight from Arke.

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Archive

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

The 5 minute MVC CMS

[Code at the bottom]

 

I had a client that needed a solution that could meet the following requirements:

  • Must be able to add and remove page from their website
  • Must be able to change the content of each of the pages
  • Users of the website would need to be able to have a logon state
  • The pages would need to show up in the navigation menu
  • Must be able to do all of this without using a developer, re-engineering their site, installing a CMS system, or taking more than 4 hours of custom development time. 

 

They also had the following merits:

  • Those who would change the content were proficient in Html, CSS, and basic web technology
  • All pages would have the same layout
  • Existing website written in ASP.NET MVC

 

In the end, the content managers had access to a "PartialPages" folder that set under the main site on the webserver.  The managers could add, remove, and edit these files.  They could also update the SiteMap.xml file for these pages, allowing for the navigation menu to update based on their changes. 

 

CODE:

 

 AreaRegistration - Routing:

 

context.MapRoute(
    "FiveMinuteCMS_Default",  // Route name
    "FiveMinuteCMS/{id}",      // URL with parameters
    new { controller = "FiveMinuteCMS", action = "Pages", id = UrlParameter.Optional }
);

 

 Controller:

 

public ActionResult Pages(string id)
{
    PagesModel model = new PagesModel();
    model.Page = System.IO.File.ReadAllText(HttpContext.Server.MapPath
        ("~/PartialPages/" + id + ".html"));       
    return View(model);
}

 

Model:

 

public class PagesModel
{
    public string Page { get; set; }
}

 

Pages View:

 

@model MySampleProject.Areas.FiveMinuteCMS.Models.PagesModel
@{
    // Any layout will do
    Layout = "~/Areas/FiveMinuteCMS/Views/Shared/_Content.cshtml";
}

@Html.Raw(Model.Page)

 

 

Sample Partial Page file:

 

<div id=”PartialContentBody”>               
    <span>Hello World</span>
</div>

 

For the site map and navigation, I used Maarten Balliauw's MvcSiteMapProvider


Tags: , ,
Categories: ASP.NET | MVC | CMS
Posted by Trenton Adams on Tuesday, August 20, 2013 4:46 PM
Permalink | Comments (0) | Post RSSRSS comment feed

StackOverflowException in COM object called from a w3wp.exe process

The w3wp.exe has a stack reserve size set at 256kb.  I ran into a StackOverflowException while calling a COM object in ASP.NET  Anyway, I didn’t have access to the source code of the COM object.  But after a lot of reading and elp from others, I figured that the third-party dll must be setting a lot of local variables or going through a large recursive call.   So I attempted the following which fixed it. 

 

After step two you only have 60 seconds to perform step 3

1.) Download WfpDeprotect: http://www.bitsum.com/wfpdeprotect.php

2.) Run:  wfpdeprotect.exe “c:\WINDOWS\system32\inetsrv\w3wp.exe”

3.) Run: editbin /STACK:1048576 “c:\WINDOWS\system32\inetsrv\w3wp.exe”

4.) Wait at least one minute

5.) Run: dumpbin /ALL /OUT:”c:\dumpbinresult.txt” “c:\WINDOWS\system32\inetsrv\w3wp.exe”

6.) Check the text file to make sure that the reserve stack size is now 1000000

 

This isn’t a permanent fix per-se.  Anytime the w3wp.exe is updated with Windows Update or something similar, the above steps will have to be re-run.


Posted by Trenton Adams on Friday, August 28, 2009 2:03 PM
Permalink | Comments (0) | Post RSSRSS comment feed

jQuery Validation. My first use and modification

I meant to update this post earlier but forgot.  The same can be accomplished using the built-in valid: option with CSS classes.

I’m relatively new to jQuery.  But I needed a client-side validation framework.  Enter jQuery.validate.  Great little framework and easy to implement.  But I needed one more thing.  When a field WAS valid, I wanted it to display a success message.  Below is the (ugly, hardcoded) additions I made.  It gives me a nice little green checkmark when the field’s all nice and valid.

 

successes: function() {

      return $(this.settings.errorElement + "." + this.settings.successClass, this.errorContext);

},

 

successesFor: function(element) {

      return this.successes().filter("[for='" + this.idOrName(element) + "']");

},

 

showSuccess: function(me) {

      for (var i = 0; this.successList[i]; i++) {

            var success = this.successList[i];

            if (success) {

                  var message = "<img src=\"../../Content/Images/greencheckmark.png\" class=\"checkmark\" />"

                  if (this.settings.successClass) { } else { this.settings.successClass = "field-validation-success"; }

                  var label = this.successesFor(success);

                  if (label.length) {

                        // refresh error/success class

                        label.removeClass().addClass(this.settings.successClass);

 

                        // check if we have a generated label, replace the message then

                        label.attr("generated") && label.html(message);

                  } else {

                        // create label

                        label = $("<" + this.settings.errorElement + "/>")

                        .attr({ "for": this.idOrName(success), generated: true })

                        .addClass(this.settings.successClass)

                        .html(message || "");

                        if (this.settings.wrapper) {

                              // make sure the element is visible, even in IE

                              // actually showing the wrapped element is handled elsewhere

                              label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();

                        }

                        if (!this.labelContainer.append(label).length)

                              this.settings.errorPlacement

                  ? this.settings.errorPlacement(label, $(success))

                  : label.insertAfter(success);

                  }

 

                  if (this.settings.success) {

                        label.text("");

                        typeof this.settings.success == "string"

            ? label.addClass(this.settings.success)

            : this.settings.success(label);

                  }

            }

      }

      if (this.successList.length) {

            this.toShow = this.toShow.add(this.containers);

      }

      if (this.settings.success) {

            for (var i = 0; this.successList[i]; i++) {

                  this.showLabel(this.successList[i]);

            }

      }

      if (this.settings.unhighlight) {

            for (var i = 0, elements = this.invalidElements(); elements[i]; i++) {

                  var label = this.successesFor(elements[i]);

                  if (label.length) {

                        label.attr("generated") && label.html("");

                  }

            }

      }

      this.toHide = this.toHide.not(this.toShow);

      this.hideErrors();

      this.addWrapper(this.toShow).show();

},

 

 

 

And modified the following function:

// http://docs.jquery.com/Plugins/Validation/Validator/element

                  element: function(element) {

                        element = this.clean(element);

                        this.lastElement = element;

                        this.prepareElement(element);

                        this.currentElements = $(element);

                        var result = this.check(element);

                        if (result) {

                              delete this.invalid[element.name];

                        } else {

                              this.invalid[element.name] = true;

                        }

                        if (!this.numberOfInvalids()) {

                              // Hide error containers on last error

                              this.toHide = this.toHide.add(this.containers);

                        }

                        this.showErrors();

                   this.showSuccess();

                        return result;

                  },


Posted by Trenton Adams on Tuesday, June 16, 2009 2:16 PM
Permalink | Comments (0) | Post RSSRSS comment feed

FedEx Integration into CRM 4.0

The FedEx Shipping manager software has a suite of integration features.  This allows one to import and export fields from external data sources including files, and ODBC connections.  After creating an ODBC connection to the CRM Database, imports were simple to setup.  But, the export was not working.  All the fields registered as read-only not matter how I set up the permissions.  I set about trying a number of work arounds.  First I started with trying to create an Access database to link to the CRM tables, but to no avail.  The FedEx integration assistant would not see the linked tables at all.  After trying a few more things with ODBC, I finally created a new database.  Within this database, I set up a single table with two columns (I was only wanting to export the tracking number for now).  An ID column and the tracking number.

 

OrderNumber TrackingNumber
   
   
   
   

 

I set up the integration in FedEx to insert a new row into this table everytime a shipment completed.  Then, to update the CRM SalesOrder.  I set an ‘on insert’ trigger on this table.  The trigger updated the appropriate record in CRM.

It’s a hack, but it worked.


Posted by Trenton Adams on Monday, May 18, 2009 10:11 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Unable to load client print control – SSRS and CRM

After some Googling, I came across this forum post: http://social.microsoft.com/Forums/en-US/crm/thread/b86740b6-6418-4e1c-9020-1d6c9c630b7b/

Basically a hotfix KB956391 broke the client control for SSRS.  We had already installed all the latest automatic updates on all the servers, but the following update isn’t presented with Windows Update.

http://www.microsoft.com/downloads/details.aspx?FamilyID=82833f27-081d-4b72-83ef-2836360a904d&DisplayLang=en

Installing this fix on ALL* related servers, then rebooting fixed the problem.  (*You can’t just install it on the SSRS machine, you need to install it on any server that allows a client to connect to reporting services.) 

Basically, this fix forces the browser to download the latest client viewer and install it.  I had found a number of other solutions that required a manual installation on the client’s computer, but this one works from the server side.


Categories: CRM | SQL Server | SSRS
Posted by Trenton Adams on Wednesday, March 11, 2009 5:53 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Microsoft Dynamics CRM 4.0 rsLogonFailed

Problem:

Web service request SetParameters to Report Server /reportserver">http://<machinename>/reportserver failed with SoapException. Error: Logon failed. (rsLogonFailed)

image

 

Fix:  Turn off the Execution Account.  Yes that’s correct, having the Yellow Warning sign is the correct setting.

image


Posted by Trenton Adams on Tuesday, February 3, 2009 7:24 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Reporting Services issues with CRM on Windows Server 2008

I recently tried installing CRM on a Windows Server 2008 machine.  I ran into a couple issues described below, along with their fixes.  I threw these notes down, so I may be missing something.  But hopefully, it'll be a start for anyone setting this up on Server 2008.

 

The migration error:

Make sure that the application pool that Reporting is running under is in Classic Mode.

 

401.2 errors:

I fought with this one for a while.  There are a couple of things you'll need to do:

  • Make sure that all authentication modes except for "Windows Authentication" is disabled.
  • Make sure that the App Pool user is a local admin on the machine

Unable to connect to the reporting service:

You'll need to open the RSWebApplication.config file located in the ReportsManager folder.  Remove the value from the <ReportServerVirtualDirectory> field and enter the full url without the ending / in the <ReportServerUrl> field.  For example: <ReportServerUrl>http://reports.contoso.com/ReportServer</ReportServerUrl>

 

When I tried installing CRM 4.0 I got the following error during installation:

"Action microsoft.crm.setup.server.rsconfigaction failed. The specified path is not a metabase path."

The solutions is addressed in the following KB article:

KB947060

Specifically, you need to add the <reportserverurl> configuration entry.  Very similar to what we had to do earlier with reporting services.


Posted by trenton adams on Monday, September 8, 2008 7:07 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Upgrading to Subversion 1.5.* on a Debian Box

  1. # apt-get clean
  2. Edit the following configuration file  /etc/apt/apt.conf.d/70debconf
  3. Add the following line to the configuration file:
    1. APT::Cache-Limit "16777216";
  4. Save and Exit
  5. Edit the following configuration file /etc/apt/sources.list
  6. Add the following two lines: 
    1. deb http://ftp.us.debian.org/debian/ sid main 
    2. deb-src http://ftp.us.debian.org/debian/ sid main
  7. Save and Exit
  8. # apt-get update
  9. # apt-get install subversion

Posted by trenton adams on Saturday, September 6, 2008 3:41 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Resetting the Mac Mini

I recently upgraded our office Mac Mini from 1GB of RAM to 2GB.  Afterwards I was having a number of issues with the machine.  Event with Macs using the Intel chipset there are still a number of differences in the system and startup procedures.  The Mac has a number of system controllers that cache settings, and occasionally become corrupt.  In the PC world, we don't have to worry about this, so it doesn't come directly to mind that you have to reset these controllers after making changes.

Resetting the Mac Mini:

Parameter RAM (PRAM) and Nonvolatile RAM (NVRAM):    Hold down Option-Apple-P-R while turning the power on.  Continue to hold until you hear the start sound twice. http://support.apple.com/kb/HT1379

Symptoms of corrupted PRAM/NVRAM - System unresponsive, Will not go past the Apple Load screen, frequent crashes or video problems.

 

System Management Controller (SMC):    Unplug all the cables (power, video, keyboard, etc.) from the mini.  Wait 15 seconds plug all cables back in.  DO NOT Hold down the power button while plugging in the power cable.  Turn on the mini. http://support.apple.com/kb/HT1543

Symptoms of corrupted SMC:  Fan runs constantly and loudly.  Performance problems. Computer sleep problems.

 

 

Power Management Unit (PMU) on older minis:    Unplug all the cables (power, video, keyboard, etc.) from the mini.  Wait 10 seconds plug all cables but the power cable back in.  Hold down the power button while plugging in the power cable.  Release the power button. Turn on the mini http://support.apple.com/kb/HT2183

Symptoms of corrupted PMU.  System won't start, peripherals won't work.


Categories: Mac | OSX
Posted by trenton adams on Friday, August 15, 2008 3:45 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Windows Live OneCare 2.5 in Beta

OneCare Connect Survey and Download

 

The new version of OneCare is now released for public beta.  OneCare now runs on Windows Server 2008!


Posted by trenton adams on Sunday, May 25, 2008 6:40 PM
Permalink | Comments (0) | Post RSSRSS comment feed