Thursday, May 19, 2011

ASPDNSF + QuickBooks Gateway + Zip 5-4 = Error

Version: AspDotNetStorefront 8.0.1.2

Problem:

Billing addresses with zip 5-4 e.g. 90019-5929 causes the QuickBooks gateway to error with the following message: The string X in the field CreditCardPostalCode is too long. The maximum length is 9.

Solution:

In file: \ASPDNSFGateways\QBMerchantServices.cs make the following modification:

//mod start Aydus 5/09/2011: Strip any non-numeric characters from zip. e.g. dash when address validation turned on.
System.Text.RegularExpressions.Regex nonNumericCharacters = new System.Text.RegularExpressions.Regex(@"[^0-9]");
creditCard.BillingPostalCode = nonNumericCharacters.Replace(UseBillingAddress.Zip, String.Empty);
//creditCard.BillingPostalCode = UseBillingAddress.Zip;
//mod end

Tuesday, May 17, 2011

How to Get ASPDotNetStorefront Store URL

Version: AspDotNetStorefront 8.x

Problem:

How do I get the current store url?

Solution:

There are a number of variables available.
In an XMLPackage use the following: <xsl:value-of select= “/root/System/StoreUrl” />
In .NET call the following function AppLogic.GetStoreHTTPLocation or AppLogic.GetStoreDomain

Tuesday, February 22, 2011

Running WordPress as Sub Domain of AspDotNetStorefront Edit Image Error

Version: ASPDotNetStorefront 9.x ML & MS

Problem:
WordPress generates an error when trying to edit an existing image in a blog.


Setup:
AspDotNetStorefront is the primary site. WordPress is a subdomain of the primary site e.g. mydomain.com/blog.  WordPress is installed on the same server.  Server is Windows 2008R2 with IIS 7.5.


Solution:
By default, a subdomain will inherit it’s parent web.config settings.  It’s not possible to use the <location path="." inheritInChildApplications="false"> tag since this will prevent all subdomains from inheriting the parent web.config and this will break admin.

Instead, include the following settings in your WordPress web.config.  Be sure to preserve any existing WordPress web.config settings and simply add the settings below.

<configuration>
    <system.web>
        <httpModules>
            <remove name="RegisterRoutes" />
            <remove name="ScriptModule" />
            <remove name="UrlRoutingModule" />
            <remove name="OnErrorHandler" />
        </httpModules>
        <httpHandlers>
            <remove verb ="*" path="execpackage.aspx" />
        </httpHandlers>
    </system.web>
    <system.webServer>
        <modules>
            <remove name="RegisterRoutes" />
            <remove name="ScriptModule" />
            <remove name="UrlRoutingModule" />
        </modules>
        <handlers>
            <remove name="HtmlPages" />
        </handlers>
    </system.webServer>
</configuration>

Friday, February 4, 2011

AspDotNetStorefront Monthly Maintenance Time-Out Error

Version: AspDotNetStorefront 9.0.1.3 (including multi-store and SP1)

Problem:

When running monthly maintenance a timeout error is generated.

Solution:

Run the monthly maintenance SQL directly on the database.  Important: only attempt this if you have a full backup of your database and have inspected each and every SQL parameter below and understand the full implications of running this stored procedure.  This is meant as a technical reference for developers and database administrators only.

aspdnsf_MonthlyMaintenance @InvalidateCustomerCookies=0, @PurgeAnonCustomers=1, @CleanShoppingCartsOlderThan=0, @CleanWishListsOlderThan=0, @CleanGiftRegistriesOlderThan=0, @EraseCCFromAddresses=1, @EraseSQLLogOlderThan=30, @ClearProductViewsOrderThan=180, @EraseCCFromOrdersOlderThan=30, @DefragIndexes=1, @PurgeDeletedRecords=0

In version 9.x, the monthly maintenance admin routine will also “Clear Profiles Older Than”.  This is a separate SQL statement not included in the stored procedure above.  The Profile table can grow large quickly and old data must be removed.  e.g. delete profile table rows > 30 days old:

delete from Profile where UpdatedOn < dateadd(d, -30, getdate())

Wednesday, January 19, 2011

Using Current.Response in Custom Class

ASP.NET

Problem:

When using Current.Response in a custom ASP.NET class there are compiler errors e.g.

The name 'HttpContext' does not exist in the current context

The type or namespace name 'HttpContext' does not exist in the namespace 'System.Web' (are you missing an assembly reference?

Solution:

  1. Add System.Web as a reference to the class.  Right click the class in the Solution Explorer and choose Add Reference. On the .NET tab select System.Web.
  2. Insert the following at the top of the class: using System.Web;

Tuesday, January 18, 2011

AspDotNetStorefront WSI Setup for eBridge

AspDotNetStorefront Version: 8.0.1.2 ML

Problem:

eBridge requires WSI to be setup in ASPDNSF for download/upload of information.

Solution:

Setup WSI according to the installation instructions located here: http://manual.aspdotnetstorefront.com/wsi/.  Instructions also included at the end of this blog.

Note that there is an issue with ASPDNSF that results in the following error when eBridge tries to connect:
System.Web.Services.Protocols.SoapHeaderException: Server unavailable, please try later ---> System.ApplicationException: WSE842: The service pipeline could not be created. ---> System.Configuration.ConfigurationErrorsException: WSE032: There was an error loading the microsoft.web.services3 configuration section. ---> System.Configuration.ConfigurationErrorsException: WSE040: Type AspDotNetStorefront.ASPDNSFUsernameTokenManager could not be loaded. Please check the configuration file.

To fix this issue following the instructions here:
http://manual.aspdotnetstorefront.com/p-1295-server-unavailable-error-with-wsi.aspx
i.e. Find the '#if WSE3' line in the App_Code\ASPDNSFUsernameTokenManager.cs file and add the following line immediately above it: #define WSE3

Setup a customer with admin access that eBridge will use to connect.

Test the WSI by navigating to http://www.yoursite.com/ipx.asmx and manually invoke the DoItUserNamePwd method using the eBridge email/password (created in the last step) for AuthenticationEMail/AuthenticationPassword and the XmlInputRequestString below.  If everthing is setup correctly you will get a page of data containing new orders.

<AspDotNetStorefrontImport Verbose="false">
  <Get Table="Orders" Name="NewOrders">
    <XmlPackage>DumpOrder.xml.config</XmlPackage>
    <OrderBy>OrderNumber asc</OrderBy>
    <DefaultWhereClause>OrderNumber >= 100</DefaultWhereClause>
  </Get>
</AspDotNetStorefrontImport>

Installing WSI

  1. Ensure that the Microsoft Web Services Enhancements version 3.0 runtime is installed on the production web server and any development servers. This is extremely important, as without WSE 3.0 your site will fail. The WSE 3.0 components are available from:
    http://www.microsoft.com/downloads/details.aspx?familyid=018A09FD-3A74-43C5-8EC1-8D789091255D&displaylang=en
  2. Copy the IPX.asmx and IPX.xml files to the root of your website
  3. Copy the App_Code/ASPDNSFUserNameTokenManager and App_Code/IPX classes to your site's App_Code directory
  4. Open the web.config file and search for "WSI". Uncomment any elements commented as required by the WSI feature.

    To test functionality, browse to http://www.yoursite.com/ipx.asmx. If you do not receive any errors, WSI should be working. Once you are comfortable that the feature is operational you should take additional measures to secure this page, such as limiting access to an IP address or range of IP addresses (this can be done via the IIS Management Console or possibly your hosting control panel). Doing so will help to prevent malicious users from scripting attacks against the interface.

Saturday, December 18, 2010

WordPress on IIS7 Upload Image Permissions

Problem:
With WordPress installed on a Windows Server with IIS7, images uploaded via WordPress admin do not display on the blog.  Image files are being uploaded to the server successfully but do not have the correct permissions (and do not inherit permissions from the parent folder).

Solution:
Change the AppPool Identity to run as LocalSystem.

WordPressonIIS7UploadImagePermissions