forwarding a request from a specific ip

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Henry

    forwarding a request from a specific ip

    I want to be able to forward any request from my one site to another site
    based on the IP address... kind of like denying access to the site if an IP
    is a certain one if they try to access any page on it and forward it to like
    google.com or something, how would you go about doing this? and can you do
    it for ranges also? thanks!


  • Scott Allen

    #2
    Re: forwarding a request from a specific ip

    Hi Brian:

    Have you investigated the Request.UserHos tAddress property?
    The Response.Redire ct method?

    --
    Scott


    On Fri, 11 Mar 2005 15:34:29 -0500, "Brian Henry"
    <brianiupmsdn@n ewsgroups.nospa m> wrote:
    [color=blue]
    >I want to be able to forward any request from my one site to another site
    >based on the IP address... kind of like denying access to the site if an IP
    >is a certain one if they try to access any page on it and forward it to like
    >google.com or something, how would you go about doing this? and can you do
    >it for ranges also? thanks!
    >[/color]

    Comment

    • Brian Henry

      #3
      Re: forwarding a request from a specific ip

      I have, and put it into the Begin Request of the global.asax file trying to
      forward any requests at the beginning of the request if it was in a list of
      IP's but it doesn't seem to work at all.


      "Scott Allen" <scott@nospam.o detocode.com> wrote in message
      news:3i2431d88e 57gtvdfgiboln8d sdbo892n5@4ax.c om...[color=blue]
      > Hi Brian:
      >
      > Have you investigated the Request.UserHos tAddress property?
      > The Response.Redire ct method?
      >
      > --
      > Scott
      > http://www.OdeToCode.com/blogs/scott/
      >
      > On Fri, 11 Mar 2005 15:34:29 -0500, "Brian Henry"
      > <brianiupmsdn@n ewsgroups.nospa m> wrote:
      >[color=green]
      >>I want to be able to forward any request from my one site to another site
      >>based on the IP address... kind of like denying access to the site if an
      >>IP
      >>is a certain one if they try to access any page on it and forward it to
      >>like
      >>google.com or something, how would you go about doing this? and can you do
      >>it for ranges also? thanks!
      >>[/color]
      >[/color]


      Comment

      • Scott Allen

        #4
        Re: forwarding a request from a specific ip

        Show us some code and, perhaps someone will spot something...

        --
        Scott


        On Fri, 11 Mar 2005 23:08:17 -0500, "Brian Henry"
        <brianiupmsdn@n ewsgroups.nospa m> wrote:
        [color=blue]
        >I have, and put it into the Begin Request of the global.asax file trying to
        >forward any requests at the beginning of the request if it was in a list of
        >IP's but it doesn't seem to work at all.
        >
        >[/color]



        Comment

        • Brian Henry

          #5
          Re: forwarding a request from a specific ip

          from global.asax

          Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As EventArgs)

          ' Fires at the beginning of each request

          If Request.UserHos tAddress = "68.70.115. 112" Then

          Response.Redire ct("http://www.google.com" )

          End If

          End Sub



          now i know that should work, but it doesn't for some reason... when i step
          through the project that doesn't even seem to fire when a request is made on
          the site for some reason







          "Scott Allen" <scott@nospam.o detocode.com> wrote in message
          news:vbs4311grd 4o3j53t92egeolt rof6ass85@4ax.c om...[color=blue]
          > Show us some code and, perhaps someone will spot something...
          >
          > --
          > Scott
          > http://www.OdeToCode.com/blogs/scott/
          >
          > On Fri, 11 Mar 2005 23:08:17 -0500, "Brian Henry"
          > <brianiupmsdn@n ewsgroups.nospa m> wrote:
          >[color=green]
          >>I have, and put it into the Begin Request of the global.asax file trying
          >>to
          >>forward any requests at the beginning of the request if it was in a list
          >>of
          >>IP's but it doesn't seem to work at all.
          >>
          >>[/color]
          >
          >
          >[/color]


          Comment

          • Juan T. Llibre

            #6
            Re: forwarding a request from a specific ip

            Try the same thing in Sub Session_OnStart



            Juan T. Llibre
            ASP.NET MVP

            Foros de ASP.NET en EspaƱol
            Ven, y hablemos de ASP.NET...
            =============== =======

            "Brian Henry" <brianiupmsdn@n ewsgroups.nospa m> wrote in message
            news:eB8XtjsJFH A.3500@TK2MSFTN GP14.phx.gbl...[color=blue]
            > from global.asax
            >
            > Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As EventArgs)
            >
            > ' Fires at the beginning of each request
            >
            > If Request.UserHos tAddress = "68.70.115. 112" Then
            >
            > Response.Redire ct("http://www.google.com" )
            >
            > End If
            >
            > End Sub
            >
            >
            >
            > now i know that should work, but it doesn't for some reason... when i step
            > through the project that doesn't even seem to fire when a request is made
            > on the site for some reason[/color]
            [color=blue]
            > "Scott Allen" <scott@nospam.o detocode.com> wrote in message
            > news:vbs4311grd 4o3j53t92egeolt rof6ass85@4ax.c om...[color=green]
            >> Show us some code and, perhaps someone will spot something...
            >>
            >> --
            >> Scott
            >> http://www.OdeToCode.com/blogs/scott/
            >>
            >> On Fri, 11 Mar 2005 23:08:17 -0500, "Brian Henry"
            >> <brianiupmsdn@n ewsgroups.nospa m> wrote:
            >>[color=darkred]
            >>>I have, and put it into the Begin Request of the global.asax file trying
            >>>to
            >>>forward any requests at the beginning of the request if it was in a list
            >>>of
            >>>IP's but it doesn't seem to work at all.
            >>>
            >>>[/color]
            >>
            >>
            >>[/color]
            >
            >[/color]


            Comment

            Working...