* Global.asax.cs: ignored routes are revisited

* YavscApiController.cs: implements a default web api response

* Web.csproj: bask to net451

* AccountController.cs: refactoring

* Web.config: removes the app setting "ClientValidationEnabled"

* Web.config: Makes true the clientValidationEnabled app parameter

* packages.config: retargeting Paypal api to net451

* AccountController.cs: xml doc
vnext
Paul Schneider 9 years ago
parent e9eddf56a7
commit ab4471e974
9 changed files with 94 additions and 38 deletions

@ -32,7 +32,7 @@ namespace Yavsc.ApiControllers
/// <summary>
/// Account controller.
/// </summary>
public class AccountController : ApiController
public class AccountController : YavscApiController
{
/// <summary>
@ -89,13 +89,7 @@ namespace Yavsc.ApiControllers
}
private HttpResponseMessage DefaultResponse()
{
return ModelState.IsValid ?
Request.CreateResponse (System.Net.HttpStatusCode.OK) :
Request.CreateResponse (System.Net.HttpStatusCode.BadRequest,
ValidateAjaxAttribute.GetErrorModelObject (ModelState));
}
/// <summary>
/// Resets the password.

@ -0,0 +1,42 @@
//
// YavscApiController.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.Net.Http;
namespace Yavsc.ApiControllers
{
public abstract class YavscApiController : ApiController
{
public YavscApiController ()
{
}
protected HttpResponseMessage DefaultResponse()
{
return ModelState.IsValid ?
Request.CreateResponse (System.Net.HttpStatusCode.OK) :
Request.CreateResponse (System.Net.HttpStatusCode.BadRequest,
ValidateAjaxAttribute.GetErrorModelObject (ModelState));
}
}
}

@ -1,3 +1,23 @@
2015-09-11 Paul Schneider <paul@pschneider.fr>
* Global.asax.cs: ignored routes are revisited
* YavscApiController.cs: implements a default web api response
* Web.csproj: bask to net451
* AccountController.cs: refactoring
* Web.config: removes the app setting
"ClientValidationEnabled"
* Web.config: Makes true the clientValidationEnabled app
parameter
* packages.config: retargeting Paypal api to net451
* AccountController.cs: xml doc
2015-09-10 Paul Schneider <paul@pschneider.fr>
* Circles.aspx: fixes circle updates

@ -259,12 +259,12 @@ namespace Yavsc.Controllers
}
[Authorize]
[HttpGet]
/// <summary>
/// Profile the specified id.
/// </summary>
/// <param name="id">Identifier.</param>
[Authorize]
[HttpGet]
public ActionResult Profile (string id)
{
if (id == null)
@ -277,14 +277,14 @@ namespace Yavsc.Controllers
[Authorize]
[HttpPost]
/// <summary>
/// Profile the specified id, model and AvatarFile.
/// </summary>
/// <param name="id">Identifier.</param>
/// <param name="model">Model.</param>
/// <param name="AvatarFile">Avatar file.</param>
[Authorize]
[HttpPost]
public ActionResult Profile (string id, Profile model, HttpPostedFileBase AvatarFile)
{
// ASSERT("Membership.GetUser ().UserName is made of simple characters, no slash nor backslash"

@ -33,18 +33,18 @@ namespace Yavsc
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 ("{resource}.axd/{*pathInfo}"); // not used
routes.IgnoreRoute ("Scripts/{*pathInfo}"); // web user side scripts
routes.IgnoreRoute ("App_Theme/{*pathInfo}"); // sites themes
routes.IgnoreRoute ("images/{*pathInfo}"); // site images
routes.IgnoreRoute ("users/{*pathInfo}"); // user's files
routes.IgnoreRoute ("avatars/{*pathInfo}"); // user's avatar
routes.IgnoreRoute ("bfiles/{*pathInfo}"); // Blog files
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.IgnoreRoute ("favicon.ico"); // favorite icon
routes.IgnoreRoute ("favicon.png"); // favorite icon
routes.IgnoreRoute ("robots.txt"); // for search engine robots
routes.MapRoute (
"Blogs",
"Blogs/{action}/{user}/{title}",

@ -34,7 +34,7 @@
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<!-- <validation validateIntegratedModeConfiguration="false" /> -->
<handlers>
<remove name="BlockViewHandler" />
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />

@ -37,7 +37,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
affects performance, set this value to true only
during development.
-->
<compilation defaultLanguage="C#" debug="true" >
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
@ -85,7 +85,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
<httpRuntime maxRequestLength="52428800" />
<trace enabled="false" localOnly="true" pageOutput="true" requestLimit="10" traceMode="SortByTime" />
<trace enabled="true" localOnly="true" pageOutput="true" requestLimit="10" traceMode="SortByTime" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="auto" uiCulture="auto" enableClientBasedCulture="true" />
<membership defaultProvider="NpgsqlMembershipProvider" userIsOnlineTimeWindow="1">
<providers>
@ -100,9 +100,10 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
</providers>
</roleManager>
<userNameManager defaultProvider="NpsqlUserNameProvider">
<providers>
<add name="NpsqlUserNameProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.RolesAndMembers.NpgsqlUserNameProvider, NpgsqlMRPProviders" autogenerateschema="false" ></add>
</providers>
<providers>
<add name="NpsqlUserNameProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.RolesAndMembers.NpgsqlUserNameProvider, NpgsqlMRPProviders" autogenerateschema="false">
</add>
</providers>
</userNameManager>
<workflow defaultProvider="ITProvider">
<providers>
@ -253,7 +254,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add name="yavsc" connectionString="Server=127.0.0.1;Port=5432;Database=YavscDev;User Id=yavscdev;Password=admin;Encoding=Unicode;" providerName="Npgsql" />
</connectionStrings>
<appSettings>
<add key="MonoServerDefaultIndexFiles" value="index.html,Index.aspx" />
<add key="MonoServerDefaultIndexFiles" value="index.html,Index.aspx" />
<add key="WorkflowContentProviderClass" value="yavsc.NpgsqlContentProvider" />
<add key="SmtpServer" value="smtp.free.fr" />
<add key="AdminEMail" value="paulschneider@free.fr" />
@ -262,7 +263,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add key="DefaultController" value="Blogs" />
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
<add key="ClientValidationEnabled" value="true" />
<!-- <add key="ClientValidationEnabled" value="true" /> -->
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger" />
</appSettings>

@ -9,7 +9,7 @@
<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{603C0E0B-DB56-11DC-BE95-000D561079B0};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Yavsc</RootNamespace>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -23,7 +23,6 @@
<AspNet DisableCodeBehindGeneration="True" />
</AspNet>
<AssemblyName>Yavsc</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CustomCommands>
<CustomCommands>
<Command type="BeforeExecute" />
@ -40,7 +39,6 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AssemblyName>Yavsc</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>bin\Yavsc.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'MVC2|AnyCPU' ">
@ -49,7 +47,6 @@
<DefineConstants>DEBUG,TEST,WEBAPI</DefineConstants>
<WarningLevel>4</WarningLevel>
<AssemblyName>maeweb</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -96,9 +93,6 @@
<Reference Include="PayPalButtonManagerSDK">
<HintPath>..\packages\PayPalButtonManagerSDK.2.9.109\lib\net20\PayPalButtonManagerSDK.dll</HintPath>
</Reference>
<Reference Include="PayPalCoreSDK">
<HintPath>..\packages\PayPalCoreSDK.1.6.2\lib\net45\PayPalCoreSDK.dll</HintPath>
</Reference>
<Reference Include="xunit.abstractions">
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
@ -108,6 +102,9 @@
<Reference Include="xunit.core">
<HintPath>..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
<Reference Include="PayPalCoreSDK">
<HintPath>..\packages\PayPalCoreSDK.1.6.2\lib\net451\PayPalCoreSDK.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
@ -141,6 +138,7 @@
<Folder Include="App_Themes\green\" />
<Folder Include="App_Themes\blue\" />
<Folder Include="App_Themes\dark\" />
<Folder Include="bfiles\" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\HomeController.cs" />
@ -209,6 +207,7 @@
<Compile Include="Helpers\Google\PeopleApi.cs" />
<Compile Include="ApiControllers\PaypalController.cs" />
<Compile Include="ApiControllers\AuthorizationDenied.cs" />
<Compile Include="ApiControllers\YavscApiController.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Web.config" />

@ -11,7 +11,7 @@
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="Npgsql" version="2.2.5" targetFramework="net45" />
<package id="PayPalButtonManagerSDK" version="2.9.109" targetFramework="net45" />
<package id="PayPalCoreSDK" version="1.6.2" targetFramework="net45" />
<package id="PayPalCoreSDK" version="1.6.2" targetFramework="net451" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />

Loading…