Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7877061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:16:20+00:00 2026-06-03T03:16:20+00:00

What I got: SecureBasePage.vb (to be inherited by pages that require to login) Default.aspx

  • 0

What I got:

  • SecureBasePage.vb (to be inherited by pages that require to login)
  • Default.aspx which inherits SecureBasePage

What should be the case: client requests Default.aspx but gets redirected to login because he isn’t logged in.

SecureBasePage.vb has this constructor

Public Sub ()
        If userIsAuthenticated Then

        Else
            Throw New LoginException()
        End If

End Sub

This results in a exception LoginException. Now I want to let it being catched by a somehow global exception handler which kicks the client to login.aspx.

I know there is a function Application_Error() in Global.asax but in my opinion this isn’t an exception handler as it only takes the Server.GetLastError() and doesn’t catch the exception. So more likely this function is to allow a developer to send an email about the unhandled exception. I’d call this a ‘global unhandled exception handler’ instead of an ‘global exception handler‘.

Is there anything I can kinda try-catch to catch the constructors exception throwing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:16:21+00:00Added an answer on June 3, 2026 at 3:16 am

    Since all pages requiring login will inherit from the SecureBasePage class, it would probably make the most sense to implement your logic there. Just override one of the page methods like OnLoad or OnPreLoad to handle the redirection.

    I wouldn’t advise depending on the global.asax to handle the errors, so your base class is probably the most appropriate place.

    EDIT

    As a general rule of thumb, you shouldn’t use exceptions to control the flow of logic. Unless the exception itself contains useful logging information, it’s probably more costly than beneficial, especially for logic that’s going to be used on nearly every request.

    This article offers some useful advice on the topic:

    • Best Practices of Exception Management
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
Got a strange problem created a little stored proc which need to execute a
Got a c#.net app which I need to modify. The query at the moment
Got a task to make a program that registers animals and the object is
Got into confusion I have to do book shelf for tablet. Which holds books
Got that error when trying to push updated app to Heroku (probably the same
got a question, is it possible to hide image and show iframe which are
Got a situation where we have a working production website that is moving to
Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got an activity that extends ListActivity . The list is backed up by a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.