Can a asp.net page use more than one codebehind page?
Posted on 2004-09-10
Heres the issue.
I'm about to build an intranet which uses the username variable as a lookup in an Oracle table. It uses the username to see what access he/she has. My existing intranet does this by inserting the following code at the top of every page that needs these access checks:
<% v_APPNAME = "BILLING" %>
<!--#include virtual="/shared/CHECK_ACCESS.asp" -->
The CHECK_ACCESS.asp uses the v_APPNAME value and the username which is stored in a session variable to query the table. If a record is returned, then the person has access... if not they are redirected to a friendly access denied.
Every page that needs to have the access checked has the v_APPNAME = "????" line and the CHECK_ACCESS.asp include line at the very top.
How would I emulate this in ASP.NET? My old asp brain is telling me to build this asp.net codebehind and attach it as I already do. But I can't find anything written that suggests it's an option to have multple codebehinds.
I really don't want to add code to each codebehind that belongs to other pages...
What do you think? Keith