Files
yavsc/web/Global.asax.cs
Paul Schneider 53930befd3 * AccountController.cs: Register and reset passord
from Web API

* GCMController.cs: initial creation, will host GCM calls and related
  procedures.

* ResetPassword.aspx: Html view to reset the password

* LocalizedText.resx:
* LocalizedText.fr.resx: new String form circles

* Web.config:
* Web.csproj:
* YavscModel.csproj:
* LocalizedText.Designer.cs:
* Profile.cs:
* Profile.cs:
* LocalizedText.fr.Designer.cs:
* LoginModel.cs:
* Publishing.cs:
* CalendarController.cs:
* LoginModel.cs:
* GCMRegister.cs:
* Publishing.cs:
* GCMRegister.cs:
* NewRoleModel.cs:
* NewRoleModel.cs:
* RegisterModel.cs:
* NewAdminModel.cs:
* RegisterModel.cs:
* NewAdminModel.cs:
* LostPasswordModel.cs:
* RegisterViewModel.cs:
* RegisterViewModel.cs:
* ProviderPublicInfo.cs:
* RegisterClientModel.cs:
* ChangePasswordModel.cs:
* ProviderPublicInfo.cs:
* RegisterClientModel.cs:
* ChangePasswordModel.cs: Fixes a typo (in the namespace :-/)

* NpgsqlCircleProvider.cs: Fixes the Circle creation

* Global.asax.cs:
* AdminController.cs:
* NpgsqlContentProvider.cs: code formatting

* BlogsController.cs:
* CircleController.cs:
* WorkFlowController.cs:
* PaypalApiController.cs:
* FrontOfficeController.cs: refactoring

* AccountController.cs: Adds the way to reset the password

* FrontOfficeController.cs: xml doc

* T.cs: Make this class an helper to translation

* YavscHelpers.cs: Implements the e-mail sending

* style.css: style uniformization

* Circles.aspx: Implements the Html interface to Circle creation
  (modifications and deletions are still to implement)

* Register.ascx: Allows the error display in case of lack of power of
  the user at registering another user.

* Estimate.aspx: use the partial view to register from the Account
  folder.
Cleans the useless reference to ~/Theme/dark/style.css, that was for
  using the "tablesorter.js", no used anymore.

* Web.config: Trying to have all the Index pages to work...
2015-06-18 11:02:23 +02:00

115 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);
}
}
}