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. posting to a href link

posting to a href link

Scheduled Pinned Locked Moved Web Development
csharphtmlsysadminhelpquestion
6 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.
  • T Offline
    T Offline
    tiwal
    wrote on last edited by
    #1

    Hello, I am developing a small c# application which simulates some simple feature of a web client . I expecially need to "redirect" this application to a page whenever I meet a tag. I initially thought I could simply use a WebRequest object for this, using the href="...." attribute as the URI where to direct the Post, but I keep catching the "internal server error (500)" web exception . So I wonder , am I doing the right thing ? Am I correct in thinking that an Html anchor tag makes a http post to the url specified in the href attribute, or is it something totally different ?

    G A 2 Replies Last reply
    0
    • T tiwal

      Hello, I am developing a small c# application which simulates some simple feature of a web client . I expecially need to "redirect" this application to a page whenever I meet a tag. I initially thought I could simply use a WebRequest object for this, using the href="...." attribute as the URI where to direct the Post, but I keep catching the "internal server error (500)" web exception . So I wonder , am I doing the right thing ? Am I correct in thinking that an Html anchor tag makes a http post to the url specified in the href attribute, or is it something totally different ?

      G Offline
      G Offline
      Graham Breach
      wrote on last edited by
      #2

      It's not quite that simple. The href="" link is usually only followed when the user clicks on it, and always uses the GET method, not POST. You might also need to include any cookies that were received with the page when you make your request.

      T 1 Reply Last reply
      0
      • G Graham Breach

        It's not quite that simple. The href="" link is usually only followed when the user clicks on it, and always uses the GET method, not POST. You might also need to include any cookies that were received with the page when you make your request.

        T Offline
        T Offline
        tiwal
        wrote on last edited by
        #3

        In effect the cookie problem is something I had completely neglected : to include this I guess I should load the "Referer"page first, extract the cookies associated with it and include them in the following GET that simulates the "href" anchor... am I right ?

        G 1 Reply Last reply
        0
        • T tiwal

          In effect the cookie problem is something I had completely neglected : to include this I guess I should load the "Referer"page first, extract the cookies associated with it and include them in the following GET that simulates the "href" anchor... am I right ?

          G Offline
          G Offline
          Graham Breach
          wrote on last edited by
          #4

          Whether you should include a cookie or not depends on the domain and path specified in the cookie, the domain and path of the new page you are loading, the cookie lifetime, etc. Here's a link to RFC 6265[^] where you can read all about them. I don't know how you are dealing with the contents of the href="" attribute, but you will have to cope with absolute links, relative links, <base href="..."> affecting the link location, and also deal with possible non-http links ("javascript:" and "mailto:" are two examples off the top of my head).

          T 1 Reply Last reply
          0
          • G Graham Breach

            Whether you should include a cookie or not depends on the domain and path specified in the cookie, the domain and path of the new page you are loading, the cookie lifetime, etc. Here's a link to RFC 6265[^] where you can read all about them. I don't know how you are dealing with the contents of the href="" attribute, but you will have to cope with absolute links, relative links, <base href="..."> affecting the link location, and also deal with possible non-http links ("javascript:" and "mailto:" are two examples off the top of my head).

            T Offline
            T Offline
            tiwal
            wrote on last edited by
            #5

            well I am quite confident that the href attribute of the anchor is always an absolute link. Anyway I included the cookies and this time it seems I made a small step forward , at least now I'm not getting the http 500 error anymore, and I can get a response too (well it's a null string , but this is a detail .. :)))....). What puzzles me is that if I use the raw href url in a web browser call, for instance using IE, I get the requested page without any error... it doesn't seem to expect any cookies form a previous response .... But I am deeply ignorant as far as the web is concerned , I'm sure there's an answer to this. What's important for now is that at least I can get past the WebResponse .... Thanks for the support.

            1 Reply Last reply
            0
            • T tiwal

              Hello, I am developing a small c# application which simulates some simple feature of a web client . I expecially need to "redirect" this application to a page whenever I meet a tag. I initially thought I could simply use a WebRequest object for this, using the href="...." attribute as the URI where to direct the Post, but I keep catching the "internal server error (500)" web exception . So I wonder , am I doing the right thing ? Am I correct in thinking that an Html anchor tag makes a http post to the url specified in the href attribute, or is it something totally different ?

              A Offline
              A Offline
              Alexhudson
              wrote on last edited by
              #6

              You may simply just link that page attributes with each other for any of your business website design service site & make that paragraph as a simple text and place an anchor tag at it. The results would be really great if you could bring it out as a do follow link rel.

              website design service | affordable website design

              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