ASP.NET SQLite / NHibernate C# Demo

This is a simple / scaled down project that can be useful as an overview of NHiberate with SQLite access and to provide a project to play around with data access.
The project is setup with:
  • Boostrap
  • NHibernate
  • SQLite Database under App_Data. It also contains the backup of the original database.
  • One Customer Entity Class
  • One Customer Mapping Class
  • One Data Access Class: NHibernate Connection, Session, Selects, Saves, and Deletes
  • It also contains a script to freeze the GridView header as found on ASPSnippets.
The customer data in this app was generated by using GenerateData.com.


Syncfusion - Visual Studio Development Suite - FREE

I was looking at the amazing tool-set offered by Syncfusion.  I have been using DevExpress for years and always on the lookout for other tools.

Syncfusion offers an entire suite of tools that cover ASP.NET Forms, MVC, Mobile (IOS, Android, Xamarin, HTML5), Windows Forms, WPF, File tools (PDF, Excel, Word), Big Data. 

The AMAZING PART is if your company's revenue is under 1 Million this product is free to use and build applications!






AMAZING!

How to Break out of ASP.NET Application_Error and redirect to a different page

A site I developed was getting the error: "A potentially dangerous Request.Path value was detected from the client (&)."

This was due to how Google was indexing the pages on the site. The site is using Friendly URLs (meaning no ?Param= or &Parm=).  Then Google appended the following parameters (and other values) to the end of the URL: &ct=ga&cd=.

Since there was no ?Param= .NET saw the &ct=ga&cd= as a hack.  This lead me down the path of trapping that error in the Global.asax Application_Error handled. When the  "A potentially dangerous Request.Path value was detected from the client (&)." error was thrown I wanted to redirect to the default home page.  

The problem was the redirect did not work and the site kept going back to the custom error message page. I then found by setting Server.ClearError() I could redirect to the home page. 
void Application_Error(object sender, EventArgs e)
{
    //... other code here....

    var Message = ex.Message.ToLower();
    var RootURL = Common.GetAppPathMasterPages() + "default.aspx";
                
    if (Message.Contains("does not exist") || Message.Contains("potentially dangerous request"))
    {
        Server.ClearError();
        CTX.Response.Redirect(RootURL);
        return;
    }    
}