Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Just not working.....

Just not working.....

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomsysadminquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VK Link
    wrote on last edited by
    #1

    Hi, I am trying to post to another server using ASP.Net. I got this code from Microsoft web site: Dim myReq As HttpWebRequest = _ WebRequest.Create("http://www.contoso.com/") I have put this code in "Button1_Click" event. It just does not transfer to the site specified. I have added the Net namespace. Is something still missing? Many thanks.

    G 1 Reply Last reply
    0
    • V VK Link

      Hi, I am trying to post to another server using ASP.Net. I got this code from Microsoft web site: Dim myReq As HttpWebRequest = _ WebRequest.Create("http://www.contoso.com/") I have put this code in "Button1_Click" event. It just does not transfer to the site specified. I have added the Net namespace. Is something still missing? Many thanks.

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      The code you showed doesn't do anyting, it just creates an object. What is it that you expect the code to do? --- b { font-weight: normal; }

      V 1 Reply Last reply
      0
      • G Guffa

        The code you showed doesn't do anyting, it just creates an object. What is it that you expect the code to do? --- b { font-weight: normal; }

        V Offline
        V Offline
        VK Link
        wrote on last edited by
        #3

        Shouldn't this redirect to the web site "http://www.contoso.com" as specified, along with the information it needs to post in the form? First, I was just trying to make sure that it redirects to above url, then post all variables info. I need to post to another server url from ASP.Net. Thanks. Vani

        G I 2 Replies Last reply
        0
        • V VK Link

          Shouldn't this redirect to the web site "http://www.contoso.com" as specified, along with the information it needs to post in the form? First, I was just trying to make sure that it redirects to above url, then post all variables info. I need to post to another server url from ASP.Net. Thanks. Vani

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          VK-Link wrote:

          Shouldn't this redirect to the web site "http://www.contoso.com" as specified, along with the information it needs to post in the form?

          No, it shouldn't. Where is that specified? You can't do redirection with the HttpWebRequest object. Take a look at the examples in the documentation[^]. --- b { font-weight: normal; }

          V 1 Reply Last reply
          0
          • V VK Link

            Shouldn't this redirect to the web site "http://www.contoso.com" as specified, along with the information it needs to post in the form? First, I was just trying to make sure that it redirects to above url, then post all variables info. I need to post to another server url from ASP.Net. Thanks. Vani

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #5

            Response.Redirect will do it. HttpWebRequest will get a request programmaticly. But will not redirect the page 1 line of code equals many bugs. So don't write any!!

            1 Reply Last reply
            0
            • G Guffa

              VK-Link wrote:

              Shouldn't this redirect to the web site "http://www.contoso.com" as specified, along with the information it needs to post in the form?

              No, it shouldn't. Where is that specified? You can't do redirection with the HttpWebRequest object. Take a look at the examples in the documentation[^]. --- b { font-weight: normal; }

              V Offline
              V Offline
              VK Link
              wrote on last edited by
              #6

              I tried this after trying the documentation you had sent me - Dim HttpWReq As HttpWebRequest = _ CType(WebRequest.Create("http://www.contoso.com"), HttpWebRequest) Dim HttpWResp As HttpWebResponse = _ CType(HttpWReq.GetResponse(), HttpWebResponse) ' Insert code that uses the response object. HttpWResp.Close() Samething - it doesn't redirect to "http://www.contoso.com" - is something amiss above? thanks so much!

              G 1 Reply Last reply
              0
              • V VK Link

                I tried this after trying the documentation you had sent me - Dim HttpWReq As HttpWebRequest = _ CType(WebRequest.Create("http://www.contoso.com"), HttpWebRequest) Dim HttpWResp As HttpWebResponse = _ CType(HttpWReq.GetResponse(), HttpWebResponse) ' Insert code that uses the response object. HttpWResp.Close() Samething - it doesn't redirect to "http://www.contoso.com" - is something amiss above? thanks so much!

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Of course it doesn't redirect, I already told you that you can't do that using a HttpWebRequest object. --- b { font-weight: normal; }

                V 1 Reply Last reply
                0
                • G Guffa

                  Of course it doesn't redirect, I already told you that you can't do that using a HttpWebRequest object. --- b { font-weight: normal; }

                  V Offline
                  V Offline
                  VK Link
                  wrote on last edited by
                  #8

                  Using a HttpWebResponse as well, after HTTPWebRequest - still wouldn't work, you say? Thanks.

                  G 1 Reply Last reply
                  0
                  • V VK Link

                    Using a HttpWebResponse as well, after HTTPWebRequest - still wouldn't work, you say? Thanks.

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #9

                    It works just fine, but it won't do a redirect. --- b { font-weight: normal; }

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups