开发者

How can I redirect a web page in Asp.Net?

How c开发者_运维知识库an I redirect www.xxx.com/hakkimda.aspx page to www.xxx.com/default.aspx?=hakkimda in Asp.Net?


Url changes, [onserver]

Response.Redirect("Default2.aspx?foo=baar",true);

Url remain Same [on server]

Server.Transfer("Default2.aspx?poop=baar");

Url changes [on client]

<script type="text/javascript">
     window.location="http://som_eother_location.html"
</script>


<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","www.xxx.com/default.aspx?=hakkimda");
}
</script> 


Response.Redirect() - msdn link


Response.Redirect("default.aspx", True)

or simplye Response.Redirect("TeleCmslogin.aspx") Hope the above line of code will helps you.


Really, the easiest way is javascript.

<script type="text/javascript"> window.location.href = "www.xxx.com/default.aspx?=hakkimda"; </script>


you should type:

   using system.web.security;

then type in page load:

  if (!Request.IsAuthenticated)
    {
        Response.Redirect("~/default.aspx");
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜