Skip to main content
CSharpUniversity ASP.NET and C# lessons

The search runs entirely in your browser over the published lesson list.

Sending a visitor to another page

A redirect moves the visitor to a different page without them choosing it. It is common after a successful save or a failed sign in.

The usual call

C#
// send the visitor to the order list
Response.Redirect("orders.aspx");

When to redirect

  • After saving, so a refresh does not save the record twice.
  • After signing in, to return the visitor to where they were going.
  • When the visitor is not allowed to see the page they asked for.
Redirect, then stop. The redirect call does not end your code by itself. Anything after it still runs, so guard the rest of the method if it matters.

Passing a value along with the visitor is the job of session state.

New lessons by email

Leave your address and get a short note whenever a fresh lesson is published. No account needed and you can stop at any time.

Thank you. Your address has been noted in this browser session. Connect a mailing service to deliver the notes for real.