Below is an example of what I am trying to accomplish regarding instantiating partial classes in an effort to make use of multiple classes (and their methods) from a single .aspx page.
login.aspx:
<%@ Page Language="C#" Codefile="Web_Code/LogonService.cs" Inherits="Client.LogonService" %>
<!-- html here, also will be calling methods here via a form -->
Web_Code/SessionHandler.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Client {
public partial class SessionHandler : Page {
//Constructor method here
public string setSessionUser(string username) {
return "this works, this is just a test";
}
}
}
Web_Code/LoginService.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Client {
public partial class LoginService : Page {
public void checkCredentials(object sender, EventArgs e) {
//Check credentials here
//If credentials are good, add the username to session
/* PROBLEM HERE: VS CAN'T FIND TYPE NOR INSTANTIATE*/
SessionHandler ses = new SessionHandler();
ses.setSessionUser(username.Value);
}
}
}
The problem is commented in Web_Code/LogonService.cs - it cannot instantiate the SessionHandler. - Why is that?
I'm switching from PHP to C# and in the PHP world I would have simply put "require("Web_Code/SessionHandler.php");" and called it a day, but the C# way seems to be a bit more involving.
I appreciate any input!