How do I stop other domains from pointing to my domain?

前端 未结 7 760
深忆病人
深忆病人 2021-02-08 12:58

I recently found out that there are other domain names pointing to my website (that don\'t belong to me) and I was wondering how people can stop/prevent this from happening. I\'

7条回答
  •  离开以前
    2021-02-08 13:17

    if you want to handle in code then do it in Global.asax in BeginRequest as below

    void Application_BeginRequest(object sender, EventArgs e)
    {
        if (!context.Request.Url.Host.ToLower().Equals("www.mydomain.com"))
        {
            context.Rewritepath("/invalidpage.aspx");
        }
    }
    

    The other simple way is to specify a host headers in IIS for your website.

    http://technet.microsoft.com/en-us/library/cc753195(v=ws.10).aspx Note: I am writing through my mobile so consider spelling mistakes

提交回复
热议问题