Use the Application_BeginRequest handler in the Global.asax file.
void Application_BeginRequest(Object source, EventArgs e)
{
Uri url = HttpContext.Current.Request.Url;
if(url.AbsolutePath != "The page I'm looking for " | url.AbsolutePath != "The other page I'm looking for ")
{
Response.Redirect("to the URL I want to redirect to");
}
}
I used url.AbsolutePath but there are other properties that might be better for your situation. See the docs. https://learn.microsoft.com/en-us/dotnet/api/system.uri?view=net-8.0