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. Validating parameters and then passing as post parameter to another site

Validating parameters and then passing as post parameter to another site

Scheduled Pinned Locked Moved ASP.NET
questiondatabasehelptutorial
2 Posts 2 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.
  • J Offline
    J Offline
    JacquesDP
    wrote on last edited by
    #1

    Hi Guys, I have a page where I check if the user is logged on in the page load event, if the user is logged in then I get the user details from a database and then immediately want to send them to a 3rd party site using post parameters from the page load event, if the are not logged in then I want to continue displaying the current page. To continue displaying the page that is busy loading if they are not logged in is not the problem, the problem I'm having is that if they are logged in I get four string variables, for example string _a = "abc"; string _b = "def"; string _c = "ghi"; string _d = "jkl"; Then I need to send them through to another site. On the other site they are checking for the following post parameters (_a, _b, _c, _d), so how do I redirect to that url and sending those parameters along as post parameters? Thanks in advance

    No matter how long he who laughs last laughs, he who laughs first has a head start!

    R 1 Reply Last reply
    0
    • J JacquesDP

      Hi Guys, I have a page where I check if the user is logged on in the page load event, if the user is logged in then I get the user details from a database and then immediately want to send them to a 3rd party site using post parameters from the page load event, if the are not logged in then I want to continue displaying the current page. To continue displaying the page that is busy loading if they are not logged in is not the problem, the problem I'm having is that if they are logged in I get four string variables, for example string _a = "abc"; string _b = "def"; string _c = "ghi"; string _d = "jkl"; Then I need to send them through to another site. On the other site they are checking for the following post parameters (_a, _b, _c, _d), so how do I redirect to that url and sending those parameters along as post parameters? Thanks in advance

      No matter how long he who laughs last laughs, he who laughs first has a head start!

      R Offline
      R Offline
      Ray Wampler
      wrote on last edited by
      #2

      If the 3rd-party site accepts variables in the query string then it's very straightforward:

          string \_a = "abc";
          string \_b = "def";
          string \_c = "ghi";
          string \_d = "jkl";
      
          string postToUrl = "http://www.RayWampler.com";
      
          Response.Redirect(postToUrl + "?\_a=" + \_a + "&\_b=" + \_b + "&\_c=" + \_c + "&\_d=" + \_d);
      

      If your values could contain special characters then you'll want to url encode them:

          string \_a = Server.UrlEncode("abc");
      

      If the 3rd-party site would only accept form POSTs then you'll need to use a technique like the one described in this article: Posting form data from ASP.NET page to another URL[^]

      Ray Wampler www.RayWampler.com

      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