Posted on

Get An Invite To Our New Locator Service

Go ahead and sign up for our Early Access Program to the My Store Locator Plus service.

My Store Locator Plus is an online subscription service that brings Store Locator Plus to ANY web technology stack.  WordPress, Django, Ruby, ASP.Net.    As long as you are hosting a site that can run JavaScript then My Store Locator Plus will work.

We are currently in the very early stages of development; what we call our “alpha release”.  It is far from being the final product but it IS functional and has been tested on various web technologies to see how well it can bring the Store Locator Plus service to non-WordPress sites.

We are now opening up our private invite to the Alpha Release of My Store Locator Plus.   The select few users that are granted access will help guide us in the features and overall user experience that will make it into our initial public launch coming in early 2017.

MySLP Locations July 2016 Alpha Release
MySLP Locations July 2016 Alpha Release

Continue reading Get An Invite To Our New Locator Service

Posted on

Sharing a Class In ASP.NET Pages

It’s easy enough to create additional classes that can be used in the code behind files of an ASP.NET page, but what if you want to share a class among the ASP pages themselves? It’s quite common and easy to develop generic methods and event handlers that can reduce repetition of code and simplify the process of creating the different parts of your UI. In a recent project, I needed to create such a class and make it available to all my ASP pages. The class contained two methods that were meant to be called by the DataBind event of a GridView or DetailView in order to assign Javascript confirmations to all the Delete Commands and looked something like this…

namespace ProjectNameSpace {

 public class AdminUI {

 public void add_delete_confirmations_to_grid_view(object sender, EventArgs e)
 {
 // Do stuff
 }

 public void add_delete_confirmations_to_detail_view(object sender, EventArgs e)
 {
 // Do stuff
 }
 }
}

Now that we have the class, we need to find the way to make it available to our ASP pages. The usual way to do this is via an entry in the web.config that makes the namespace available like this….


 
 
 

…which works fine if you intend on calling the method using ASP tags…

<% AdminUI.add_delete_confirmations_to_grid_view(); %>

…but the methods above aren’t mean to be used in ASP tags. They are meant to be assigned directly to events of ASP Controls like so…

<ASP:GridView OnDataBoundEvent="AdminUI.add_delete_confirmations_to_grid_view">

…which sadly, does not work. This seems to be something that was overlooked in ASP.NET. The former compiles, but the latter generates a “AdminUI namespace not found” type of error.

So in order to get around that, we are going to have to make use of inheritance.

Normally, the code behind classes for an ASP page are children of the System.Web.UI.Page like this….

public partial class Users : System.Web.UI.Page { }

Therefore, I can construct my AdminUI class as a middle layer between my ASP classes and System.Web.UI.Page by changing AdminUI to…

public class AdminUI : System.Web.UI.Page {}

… and all of my ASP classes to something like this…

public partial class Users : AdminUI { }

… and the assignment of the methods to their corresponding events becomes this…

<ASP:GridView OnDataBoundEvent="add_delete_confirmations_to_grid_view">

…and it works perfectly. All the methods that normally would have to be duplicated in multiple code behind files are in a centralized location and inherited by all of the classes so they can be used directly in the ASP pages without triggering a compiler error.

Posted on

web.config Inheritance in IIS

ASP.Net

A couple of notes on IIS and how it works for virtual directories/applications and web.config inheritance and ASP.Net.

 

There is a configuration file that will automatically be inherited by an asp.net application’s web.config. This configuration file is machine.config and it defines the servers/computers asp.net schema for all of its web applications.

The root web.config files is also a server configuration file. This file resides in the same directory as the machine.config and is used to define system wide configurations.

Then you have the web site specific configuration also named web.config. From the websites root directory the web.config seems to work similar to .htaccess files.

Each directory in an asp.net may have its very own web.config file. Each virtual directory may also have its own web.config. Each virtual application has its own web.config file. Each one of these files inherit their parents web.config. This is done so you can define roles in the parent web.config file and it is enforced throughout the website.

Okay a virtual directory is the windows why of performing a soft link. It is not reflected in the file system. It is only reflected in IIS. An example:

Website = c:/intetpub/wwwroot/mysite/

Files = c/users/public/documents/

In IIS you can set a virtual directory by stating c:/inetpub/wwwroot/mysite/sharefiles/ that points to c:/users/public/documents/

You can actually add a virtual folder from another server on your network.

This is not reflected in the file system. If c:/inetpub/wwwroot/mysite/sharefiles/ directory was actually added, IIS will ignore it and point to the virtual directory. This was discovered when installing reporting for MS SQL that by default adds a ~/report virtual application. One of my applications already had an ~/report directory already and the virtual application took precedence. Applications work essentially the same as folders except in an virtual application operates in their own application pool.

If you want to stop inheritance you can the following to the site’s web.config:


    
        ...
    

If you want to not inherit certain sections of the configuration then you add a tag the child section.


    
    ...