Redirect with ASP.NET

On several occasions I have needed to redirect a user from one place to another in ASP.NET. I like to do this with code similar to the following, which doesn’t require code-behind.

<%@ Page Language="C#" AutoEventWireup="true" %><!DOCTYPE html>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","/public/Default.aspx");
}
</script>

<html>
<head runat="server">
    <title>Redirecting...</title>
</head>
<body>
</body>
</html>
Advertisements

What does a website cost?

Don’t forget that growing an online business requires more than a website. You need to get online, attract customers, and manage your growing business.  Don’t forget the time it takes to continue to add new content to your website.

For those simpler informational websites, here’s what I would consider necessary

  • Buy a domain name ($10/yr)
  • Buy a hosting package ($77/yr)
  • Design your website ($2500-$8000)

For a commercial website you also need to consider

  • A merchant account for online orders (around $30 per month plus 3% of each transaction)
  • A security certificate for secure transactions ($50/yr and up)
  • Depending on your market, you may wish to add additional features that require licensing third-party web services.