且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

这个网页在asp.net中有一个重定向循环

更新时间:2022-12-09 13:35:43

请尝试使用代码



 <   script     language   =  c#    runat   =  server >  
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
Response.Status =301 Moved Permanently;
Response.AddHeader(Location,https://www.gemeya.com);
}
}
< / script &GT; 跨度>


Hi I have purchased a ssl certificate inorder to secure my webpages as you know...
But inorder to get the effect google suggest to configure a 301 redirect inorder to redirect visitors and search engine spiders to your new pages while maintaining your search engine ranking.
Now I have a masterpage and I am placing this code inside it:

<script language="c#" runat="server">

       private void Page_Load(object sender, System.EventArgs e)
       {
           Response.Status = "301 Moved Permanently";

           Response.AddHeader("Location", "https://www.gemeya.com");

       }
   </script>


as you know every page that inherit the masterpage will inherit this code also.
now I am uploading the file inlive(godaddy),then when typing my url now I got an error saying that:

This webpage has a redirect loop
The webpage at https://www.gemeya.com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.



can someone tell me about this problem.

please can someone tell me what is the problem.

Pls try with code

<script language="c#" runat="server">
   private void Page_Load(object sender, System.EventArgs e)
   {
        if (!IsPostBack)
        {
            Response.Status = "301 Moved Permanently";
            Response.AddHeader("Location", "https://www.gemeya.com");
        }
   }
</script>