Full rewrite of the portfolio site from Next.js 14 to .NET 10: - ASP.NET Core 10 Razor Pages, no Node.js dependency - EF Core 10 + SQLite (same schema as before — data survives upgrade) - Cookie authentication (same single-password model) - Resend contact form via HttpClient - Bilingual FA/EN via locale cookie + BasePageModel - All UI ported to Razor Pages with Tailwind CDN + custom CSS - Vanilla JS: particles, typewriter, cursor, animations, portfolio modal - Dockerfile: SDK 10.0-alpine → aspnet 10.0-alpine (no npm/Node needed) - CI/CD: dropped NPM_TOKEN, ADMIN_SESSION_SECRET — pure dotnet publish Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace SoroushAsadi.Pages;
|
||||
|
||||
/// <summary>POST /locale — sets the locale cookie and redirects back.</summary>
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class LocalePageModel : PageModel
|
||||
{
|
||||
public IActionResult OnPost(string locale, string returnUrl = "/")
|
||||
{
|
||||
if (locale is not "fa" and not "en") locale = "fa";
|
||||
|
||||
Response.Cookies.Append("locale", locale, new CookieOptions
|
||||
{
|
||||
Expires = DateTimeOffset.UtcNow.AddYears(1),
|
||||
HttpOnly = false,
|
||||
SameSite = SameSiteMode.Lax,
|
||||
Path = "/"
|
||||
});
|
||||
|
||||
if (!Url.IsLocalUrl(returnUrl)) returnUrl = "/";
|
||||
return LocalRedirect(returnUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user