asp.net的Server.Transfer跳转

来源:百度知道 编辑:UC知道 时间:2024/05/31 07:18:54
我只会asp,不会asp.net,请帮我把下面这段代码转成asp.net 的C#的写法,谢谢高手们.
asp代码如下,请转成asp.net的写法:
<html>
<body>
<%
dim url
url=Request.ServerVariables("HTTP_HOST")
select case url
case "a.123.com"
Server.Transfer("a/") '转入a目录
case "b.123.com"
Server.Transfer("b/") '转入b目录
case "c.123.com"
Server.Transfer("c/") '转入c目录
case else
Server.Transfer("index.html") '其它则转入主页
end select
%>
</body>
<html>
请给出一个能运行的完整页面代码.

<%@ Page Language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/C#" runat="server">
void Page_Load(object sender, EventArgs e)
{
string url = Page.Request.ServerVariables["HTTP_HOST"];
switch (url)
{
case "a.123.com":
Server.Transfer("a/");
break;
case "