Cannot login in AspDotNetStoreFront 9.5, continually redirects back to login page

August 9, 2015 at 3:42 PMMadestro

I came across a situation where I could not login to AspDotNetStoreFront. It kept redirecting me back to the login page with no apparent error message, which seemed to indicate that the login was successful, yet it wasn't doing anything.

The issue turned out to be the time zone difference between web server and database server. I was running my copy locally and the time at the server was running a few hours behind, which causes the application to think you have "timed out".

To work around this, there is an application setting named "SessionTimeoutInMinutes" that you can change to a value greater than the time zone difference, in order to keep the session active.

I had trouble locating this setting. Eventually I figured out it used to live in a configuration file apparently, but it now has been moved to table "AppConfig" in the database. Change the "ConfigValue" column value and it should allow you to log in. 

Make sure to restart the application afterwards to force reloading of the settings.

Enjoy!

Posted in: AspDotNetStoreFront

Tags:

Running Windows Authentication with IIS Express

August 6, 2015 at 10:18 AMMadestro

You may run into a situation where you have configured your site to run Windows authentication but you get an authentication error when you try to browse it during a debug session.

To fix this issue, you need to edit the Application Host file for IIS and enable Windows authentication. You can find the file here:

\My Documents\IISExpress\config\applicationhost.config

Find the <security> section inside the <system.webServer> node and enable Windows authentication as follows:

<system.webServer>
...
  <security>
...
    <authentication>
      <windowsAuthentication enabled="true" />
    </authentication>
...
  </security>
...
</system.webServer>

And that's all there is to it. :-)

Posted in: ASP.NET MVC | Visual Studio | Web Development

Tags:

How to inspect Angular scope for an HTML element

May 18, 2015 at 11:41 AMMadestro

It turns out there is a very simple way to inspect the Angular scope for a particular HTML element if you are using Chrome.

Simply right click on an element on the page, select inspect element, switch to the console tab and type the following:

angular.element($0).scope()

Alternatively, you can select an element from the HTML tab and then go to the console and type the script command.

Posted in: Angular

Tags:

How to reset AspDotNetStoreFront's Super Admin account

May 12, 2015 at 10:56 AMMadestro

I was working on a project that involved ASPDotNetStoreFront's MultiStore product and for one reason or another, my account was locked and I could not get into the administration interface.

Sadly, my account was the only Super Admin account.

Fortunately, there is a procedure that can be followed on the backend in order to reset the super admin account:

  1. Open the database with a tool that allows you to run SQL scripts, such as SQL Management Studio.
  2. Run the following query:
    • UPDATE [Customer]
           SET [Password] = 'YOUR NEW PASSWORD',
                 [SaltKey] = -1,
                 [LockedUntil] = DateAdd(mi, -1, GetDate()),
                 [BadLoginCount] = 0,
                 [PwdChangeRequired] = 0,
                 [PwdChanged] = GetDate()
           WHERE [Email] = 'SUPER ADMIN EMAIL ADDRESS'
  3. Restart the site by recycling the application or modifying the web.config file.

And that's all there is to it. Go back to your admin console and login normally.

Posted in: AspDotNetStoreFront

Tags:

Umbraco template keeps loading old version of contents in administration interface

March 12, 2015 at 10:54 AMMadestro

I am using Umbraco as the CMS for a project and came across a curious situation:

I noticed my changes to templates seemed not to be saved for some reason.

The Behavior

  1. I opened the template
  2. I modified its contents
  3. I hit save
  4. I got the message that the changes were saved successfully
  5. I could see the new version displayed on the published site
  6. I get back into the template to edit it, I get the old version instead of what I saved.

The Solution

Well, It turns out it's a caching issue. The contents are in fact saved which is why you see them on the site.

Don't ask me what Umbraco does with caching because I don't know and quite frankly I don't have the time to find out. Suffice it to say, cache is the issue.

To fix this:

  1. Log out of the Umbraco site
  2. Clear the cache
  3. Log back in

Chrome has a checkbox inside the settings of the development toolbar that allows you to "disable the cache" which is the same as deleting it for the current site.

Good luck!

Posted in: CMS

Tags:

How to replace all occurrences of a string in JavaScript

October 9, 2014 at 1:28 PMMadestro

I was working on a template in JavaScript and needed to replace all occurrences of a particular place holder string within it.

As it turns out, using the ubiquitous string.replace() function does not work as it only replaces the first occurrence.

As it turns out the following pattern can be used to achieve this:

str.split(search).join(replacement);

So, let's say I have the following variable:

var template = "This is just some hard text because it's hard to read but not so hard to write";

And I want to replace all occurrences of "hard" with "soft". I would do:

template = template.split("hard").join("soft");

The result is:

"This is just some soft text because it's soft to read but not so soft to write"

Pretty clever piece of code. It works like a charm. I wish I had thought of it myself... Cry

The original article where I found this solution can be seen here.

Posted in: JavaScript

Tags:

Package did not load correctly on Visual Studio 2012 Startup

August 18, 2014 at 10:21 AMMadestro

My network admin apparently has Windows updates setup to auto-install and reboot if needed so the computer had done that last night and Visual Studio 2012 was reloading upon startup when I came in this morning. 

To my surprise. I was greeted by a series of errors popping up as Visual Studio 2012 fired up, concerning the loading of packages.

In my case it was a number of different packages, one of them being PasteJson.JsonPackage. Restarting VS 2012 didn't help.

The issue turned out to be that VS 2012 maintains some sort of cache (meta data most likely) about the packages and it was either outdated or corrupt for some reason.

You can fix this situation easily by going to C:\Users\[INSERT USER NAME HERE]\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache and deleting all files you find in that folder.

No more errors after that. :-)

Someone mentioned to me that this might be a recurring issue so until it's fixed, just delete the files again.

Posted in: Visual Studio

Tags:

ASP.NET site that runs in Visual Studio 2012 will not run in Visual Studio 2013: mimeMap entry error

July 25, 2014 at 11:38 AMMadestro

I ran into the following error while trying to open a Visual Studio 2012 solution in the new version, Visual Studio 2013:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

The detailed information section listed the follwing config error:

"Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.woff'"

The important thing here is not the mime type. It's the action of adding it that is causing the problem.

Apparently, the IISExpress version used by Visual Studio 2013 is based on newer IIS engines (7.0 and up) which throw this error when you add the same mime type at multiple levels in the config files.

You can obviously just add it at one level and solve the problem. However, more times than not this is not ideal and you still need to have the entry there.

Fortunately, there is a simple solution. Add a Remove directive right before you add the mime type:

<staticContent>
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
 
And that's all there is to it. By removing the entry right before you re-add it, you avoid this error.

Posted in: Visual Studio | Web Development

Tags:

How to keep IISExpress running after you stop debugging in Visual Studio 2013

June 24, 2014 at 5:01 AMMadestro

It's very annoying to have the IISExpress web server close down every time you hit the STOP button in the Visual Studio Debugger.

Fortunately, it's simple enough to keep it open:

  1. Go to the web application in the Solution Explorer.
  2. Right click on it and hit "Properties" (or hit ALT + ENTER).
  3. Click on the "Web" tab on the left.
  4. Uncheck the box for "Enable Edit and Continue".

And that's all there is to it.

Posted in: Visual Studio | Web Development

Tags:

Getting your HTML e-mails to work across different e-mail clients and browsers

May 23, 2014 at 11:41 AMMadestro

If you have worked on creating HTML e-mails, you know how frustrating and time consuming it can be.

Not all browsers (and e-mail clients) are created equal, so it's very hard to get stuff to look the same in all of them.

I was editing an e-mail the other day and sure enough, it looked great in one browser but completely messed up on the other.

While  reviewing the HTML in Chrome with the Developer toolbar (F12), I noticed a couple of interesting things:

1. The Elements tab does not display MY code. It displays Chrome's rendering which presumably fixes some inconsistencies and most importantly ADDS consistency by tweaking your HTML slightly.

2. The styles tab displays a box at the bottom with a drawing representing the ACTUAL size, margin and padding of the selected object. Notice I said ACTUAL, not the HTML/CSS defined values.

So, armed with these two things, I did the following:

1. Made sure I got it looking great on Chrome.

2. Copied the source from the Elements tab and replaced my source (right click on the HTML node and select "Copy as HTML"). This effectively gives me cleaner, Google-sanitized HTML code.

3. Used the little Styles tab to get the ACTUAL height, width, margin and padding of my objects. I then drew a little diagram on paper to make sure the numbers made sense (sometimes you put a table with 500 width and include a 520 width TD in it, lol). I took all the ACTUAL values and replaced my ORIGINAL values. For instance, if I had declared a width of 500px for a table, but the actual value was 495px and the table looked great, I replaced the 500px with 495px on my document.

Needless to say, it worked like a charm.

Granted, this is not going to fix all inconsistencies among browsers/clients. Some issues require more complex workarounds but this will take you most of the way.

I also know there are tools out there that can do this for you. This is just a quick, free way to get your HTML e-mails displaying properly (for the most part).

Good luck!

Posted in: Web Development

Tags: