* Web.config: * ListItem.cs: * styles.json: * globalize.js: * event.js: * Auth.aspx: * Book.aspx: * Login.aspx: * jquery-2.1.4.js: * map-load.gif: * Book.aspx: * Circle.cs: * Auth.aspx: * mapstyle.css: * date.js: * Login.aspx: * mdd_help.htm: * BlogHelper.cs: * fit-bounds.png: * unresolved.js: * jquery-2.1.4.min.js: * mapstyle-ie.css: * FreeDate.cs: * BookEdit.cs: * number.js: * BlogManager.cs: * plural.js: * jquery-2.1.4.min.map: * jquery.googlemaps.js: * supplemental.js: * BlogProvider.cs: * mapstyle.min.css: * pin-pink.png: * message.js: * ChooseADate.aspx: * pin-azure.png: * currency.js: * jquery-2.1.4-vsdoc.js: * pin-green.png: * MarkdownDeepLib.min.js: * flag-azure.png: * flag-green.png: * needle-pink.png: * ChooseADate.aspx: * niddle-green.png: * ChooseCalendar.aspx: * current-location.png: * jquery.googlemaps.min.js: * ErrorMessage.aspx: * ChooseCalendar.aspx: * relative-time.js: * GoogleErrorMessage.aspx: * popup-template-marker.html: * popup-template-circle.html: * popup-template-polygon.html: * popup-template-polyline.html: * popup-template-rectangle.html: * Web.csproj: * YavscModel.csproj: * YavscClient.csproj: * fortune.csproj: * WebControls.csproj: * SalesCatalog.csproj: * ITContentProvider.csproj: * NpgsqlMRPProviders.csproj: * NpgsqlBlogProvider.csproj: * NpgsqlContentProvider.csproj: Moves to Mono framework * NpgsqlCircleProvider.cs: Makes Circles private, or not * OAuth2.cs: * CircleController.cs: * AccountController.cs: * NpgsqlContentProvider.cs: Impacts htmldoc * NpgsqlMembershipProvider.cs: Makes possible to change the UserName * NpgsqlRoleProvider.cs: Drops this SQL code, which is actually maintained in Web/instdbws.sql * PeopleApi.cs: * GoogleController.cs: * PaypalController.cs: Refactoring * Global.asax.cs: Dropped an useless url mapping * MarkdownHelper.cs: Package update * App.master: * NoLogin.master: Site's favicon update * Circles.aspx: TO BE FIXED :-D * UserPost.aspx: Comment only when logged in * instdbws.sql: Circle public * packages.config: package update
114 lines
3.1 KiB
C#
114 lines
3.1 KiB
C#
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Routing;
|
|
using Yavsc.Formatters;
|
|
using Yavsc.Model.FrontOffice;
|
|
using System.Web.SessionState;
|
|
using System.Web.Mvc;
|
|
using System.Web.Http;
|
|
using System.Web.WebPages.Scope;
|
|
using System.Reflection;
|
|
using System.Web.Configuration;
|
|
|
|
namespace Yavsc
|
|
{
|
|
|
|
/// <summary>
|
|
/// Mvc application.
|
|
/// </summary>
|
|
public class MvcApplication : System.Web.HttpApplication
|
|
{
|
|
|
|
/// <summary>
|
|
/// Registers the routes.
|
|
/// </summary>
|
|
/// <param name="routes">Routes.</param>
|
|
public static void RegisterRoutes (RouteCollection routes)
|
|
{
|
|
// Should be FrontOffice in a POS,
|
|
string defaultController =
|
|
WebConfigurationManager.AppSettings ["DefaultController"];
|
|
if (defaultController == null)
|
|
defaultController = "Home";
|
|
routes.IgnoreRoute ("{resource}.axd/{*pathInfo}");
|
|
routes.IgnoreRoute ("Scripts/{*pathInfo}");
|
|
routes.IgnoreRoute ("Theme/{*pathInfo}");
|
|
routes.IgnoreRoute ("images/{*pathInfo}");
|
|
routes.IgnoreRoute ("users/{*pathInfo}");
|
|
routes.IgnoreRoute ("files/{*pathInfo}");
|
|
routes.IgnoreRoute ("avatars/{*pathInfo}");
|
|
routes.IgnoreRoute ("xmldoc/{*pathInfo}"); // xml doc
|
|
routes.IgnoreRoute ("htmldoc/{*pathInfo}"); // html doc
|
|
routes.IgnoreRoute ("favicon.ico");
|
|
routes.IgnoreRoute ("favicon.png");
|
|
routes.IgnoreRoute ("robots.txt");
|
|
routes.MapRoute (
|
|
"Blog",
|
|
"Blog/{user}/{title}",
|
|
new { controller = "Blogs", action = "Index", user=UrlParameter.Optional, title = UrlParameter.Optional }
|
|
);
|
|
routes.MapRoute (
|
|
"Blogs",
|
|
"Blogs/{action}/{user}/{title}",
|
|
new { controller = "Blogs", action = "Index", user=UrlParameter.Optional, title = UrlParameter.Optional }
|
|
);
|
|
/*routes.MapRoute (
|
|
"Account",
|
|
"Account/{action}/{user}",
|
|
new { controller = "Account", action = "Index", user=UrlParameter.Optional }
|
|
); */
|
|
routes.MapRoute (
|
|
"Default",
|
|
"{controller}/{action}/{user}/{title}",
|
|
new { controller = defaultController,
|
|
action = "Index",
|
|
user=UrlParameter.Optional,
|
|
title = UrlParameter.Optional }
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Starts the Application.
|
|
/// </summary>
|
|
protected void Application_Start ()
|
|
{
|
|
AreaRegistration.RegisterAllAreas ();
|
|
WebApiConfig.Register (GlobalConfiguration.Configuration);
|
|
RegisterRoutes (RouteTable.Routes);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Applications the post authorize request.
|
|
/// </summary>
|
|
protected void Application_PostAuthorizeRequest()
|
|
{
|
|
if (IsWebApiRequest())
|
|
{
|
|
HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
|
|
}
|
|
}
|
|
|
|
private bool IsWebApiRequest()
|
|
{
|
|
return HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath.StartsWith(WebApiConfig.UrlPrefixRelative);
|
|
}
|
|
|
|
/// <summary>
|
|
/// begins a request against this application.
|
|
/// </summary>
|
|
protected void Application_BeginRequest()
|
|
{
|
|
var ob = typeof(
|
|
AspNetRequestScopeStorageProvider).Assembly.GetType(
|
|
"System.Web.WebPages.WebPageHttpModule").GetProperty
|
|
("AppStartExecuteCompleted",
|
|
BindingFlags.NonPublic | BindingFlags.Static);
|
|
ob.SetValue(null, true, null);
|
|
|
|
}
|
|
}
|
|
}
|
|
|