Index: binary-improvements2/WebServer/src/UrlHandlers/SessionHandler.cs
===================================================================
--- binary-improvements2/WebServer/src/UrlHandlers/SessionHandler.cs	(revision 418)
+++ binary-improvements2/WebServer/src/UrlHandlers/SessionHandler.cs	(revision 422)
@@ -61,5 +61,5 @@
 		private void HandleUserPassLogin (RequestContext _context, string _remoteEndpointString) {
 			if (!_context.Request.HasEntityBody) {
-				_context.Response.Redirect (pageErrorPath + "NoLoginData");
+				WebUtils.WriteText (_context.Response, "NoLoginData", HttpStatusCode.BadRequest);
 				return;
 			}
@@ -76,15 +76,15 @@
 				Log.Error ("Error deserializing JSON from user/password login:");
 				Log.Exception (e);
-				_context.Response.Redirect (pageErrorPath + "InvalidLoginJson");
+				WebUtils.WriteText (_context.Response, "InvalidLoginJson", HttpStatusCode.BadRequest);
 				return;
 			}
 
 			if (!inputJson.TryGetValue ("username", out object fieldNode) || fieldNode is not string username) {
-				_context.Response.Redirect (pageErrorPath + "InvalidLoginJson");
+				WebUtils.WriteText (_context.Response, "InvalidLoginJson", HttpStatusCode.BadRequest);
 				return;
 			}
 
 			if (!inputJson.TryGetValue ("password", out fieldNode) || fieldNode is not string password) {
-				_context.Response.Redirect (pageErrorPath + "InvalidLoginJson");
+				WebUtils.WriteText (_context.Response, "InvalidLoginJson", HttpStatusCode.BadRequest);
 				return;
 			}
@@ -94,5 +94,5 @@
 			if (!webUser.HasValue) {
 				Log.Out ($"[Web] User/pass login failed from {_remoteEndpointString}");
-				_context.Response.Redirect (pageErrorPath + "UserPassInvalid");
+				WebUtils.WriteText (_context.Response, "UserPassInvalid", HttpStatusCode.Unauthorized);
 				return;
 			}
@@ -144,5 +144,5 @@
 
 		public static void HandleUserIdLogin (ConnectionHandler _connectionHandler, RequestContext _context, string _remoteEndpointString,
-			string _loginName, string _errorPage, string _username, PlatformUserIdentifierAbs _userId, PlatformUserIdentifierAbs _crossUserId = null, bool _redirect = true) {
+			string _loginName, string _errorPage, string _username, PlatformUserIdentifierAbs _userId, PlatformUserIdentifierAbs _crossUserId = null, bool _sendResponse = true) {
 			try {
 				WebConnection con = _connectionHandler.LogIn (_context.Request.RemoteEndPoint!.Address, _username, _userId, _crossUserId);
@@ -165,12 +165,12 @@
 				_context.Response.AppendCookie (cookie);
 
-				if (_redirect) {
-					_context.Response.Redirect (pageBasePath);
+				if (_sendResponse) {
+					WebUtils.WriteText (_context.Response, "");
 				}
 			} catch (Exception e) {
 				Log.Error ($"[Web] Error during {_loginName} login:");
 				Log.Exception (e);
-				if (_redirect) {
-					_context.Response.Redirect (pageErrorPath + _errorPage);
+				if (_sendResponse) {
+					WebUtils.WriteText (_context.Response, "LoginError", HttpStatusCode.InternalServerError);
 				}
 			}
