I have a Web Form whose sole purpose is to redirect to other pages. I created it as a normal aspx page and then I deleted everything in the .aspx file and kept just the first line shown below–even the Doctype and HTML tag are gone now:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Redirect.aspx.cs" Inherits="Web.Redirect" %>
I also deleted the .designer.cs file as it contained nothing. It works, but I wonder if what I did is right. Are there any concerns about removing all HTML content from the Web Form in this case?
None whatsoever. What you have done is perfectly acceptable.
However, if the sole purpose of the pages is to redirect, I would use a Handler/ASHX file as it can be used in exactly the same way and doesn’t have as much overhead as the ASPX page.
Here is a description and example of how to use one.