Getting and sending data from third party software

Discussion in 'ASP .Net' started by Beryl Small, Dec 1, 2003.

  1. Beryl Small

    Beryl Small Guest

    Hi, I have a third party software that needs to send
    information to an .aspx page for processing to communicate
    with an SQL database. The software sends the information
    something like this:

    Mypage.aspx?Password=Mypassword

    When this request hits the page, I need to pull that
    variable Mypassword to use in my VB function to query the
    database. I'm confused on how to get it. I tried using
    Request.Form("password") and Request.QueryString
    ("password") but it doesn't work. I'm also going to have
    to send a response back to this other software (Authorware
    Macromedia). Anyone know how this should be done?
     
    Beryl Small, Dec 1, 2003
    #1
    1. Advertising

  2. Beryl Small

    vMike Guest

    Request.Querystring should work. I believe it is case sensitive though. So
    you need to use Request.Querystring.Item("Password")

    "Beryl Small" <> wrote in message
    news:048601c3b814$baee6c30$...
    > Hi, I have a third party software that needs to send
    > information to an .aspx page for processing to communicate
    > with an SQL database. The software sends the information
    > something like this:
    >
    > Mypage.aspx?Password=Mypassword
    >
    > When this request hits the page, I need to pull that
    > variable Mypassword to use in my VB function to query the
    > database. I'm confused on how to get it. I tried using
    > Request.Form("password") and Request.QueryString
    > ("password") but it doesn't work. I'm also going to have
    > to send a response back to this other software (Authorware
    > Macromedia). Anyone know how this should be done?
     
    vMike, Dec 1, 2003
    #2
    1. Advertising

  3. Beryl Small

    Beryl Small Guest

    Okay, I figured out how to get the value from the URL.
    Request.Querystring works, but I don't know how to get the
    value returned from the result of my SQL query back to
    authorware. I need to be able to post the result to the
    same page that executed Query. Anyone know how to do this?
    >-----Original Message-----
    >Hi, I have a third party software that needs to send
    >information to an .aspx page for processing to

    communicate
    >with an SQL database. The software sends the information
    >something like this:
    >
    >Mypage.aspx?Password=Mypassword
    >
    >When this request hits the page, I need to pull that
    >variable Mypassword to use in my VB function to query the
    >database. I'm confused on how to get it. I tried using
    >Request.Form("password") and Request.QueryString
    >("password") but it doesn't work. I'm also going to have
    >to send a response back to this other software

    (Authorware
    >Macromedia). Anyone know how this should be done?
    >.
    >
     
    Beryl Small, Dec 2, 2003
    #3
  4. Beryl Small

    vMike Guest

    Well that depends on a few things. You could create a form with the data and
    post it to the third party, but I would look into WebRequest/Response. Here
    is an example I have snipped, it may need to be changed to work. Also check
    this site out.
    http://west-wind.com/presentations/dotnetWebRequest/dotnetWebRequest.htm

    Public Shared Function mgGetWebcontent(strWebSite as string, strWebPage as
    string, strPostData as string, Optional intContentType as int32 = 0,
    Optional httpFile as httpPostedFile = nothing) as string

    Dim mgWebRequest As HttpWebRequest
    Dim mgWebResponse As HttpWebResponse
    Dim strText As String
    Dim mgStreamReader As StreamReader

    Try
    mgWebRequest =CType(WebRequest.Create(strWebSite &
    strWebPage),HttpWebRequest)
    mgWebRequest.timeout = 90000
    mgWebRequest.CookieContainer = new cookiecontainer()
    dim k as int32
    Dim siteUri As New Uri(strWebSite)
    for k = 0 to HttpContext.Current.Request.Cookies.count - 1
    'add your cookies here
    dim ck as cookie = new cookie()
    ck.name = HttpContext.Current.Request.Cookies(k).name
    next k
    mgWebRequest.UserAgent =
    HttpContext.Current.Request.Headers("User-Agent")
    mgWebRequest.Accept =
    HttpContext.Current.Request.Headers("Accepts")

    mgWebRequest.headers.add("Cookie",HttpContext.Current.Request.Headers("Cooki
    e"))

    if strPostData.length > 0 or not httpfile is nothing then

    mgWebRequest.Method = "POST"

    select case intContentType
    Case = 1 'file post
    ' separate function snipped out will post if you need it
    Case else
    mgWebRequest.ContentType = "application/x-www-form-urlencoded"
    mgWebRequest.ContentLength = strPostData.length 'length
    Dim mgStreamWriter As new
    StreamWriter(mgWebRequest.GetRequestStream())

    mgStreamWriter.Write(strPostData)
    mgStreamWriter.Close()
    end select


    else
    mgWebRequest.Method = "GET"
    end if
    mgWebResponse = CType(mgWebRequest.GetResponse(),HttpWebResponse)

    ' you may not need the next part if you don't need the response cookies
    and text

    mgWebResponse.cookies =
    mgWebrequest.CookieContainer.GetCookies(mgWebrequest.RequestUri)
    mgStreamReader = New StreamReader(mgWebResponse.GetResponseStream())

    strText = mgStreamReader.ReadToEnd()
    dim i as int32

    for i = 0 to mgWebResponse.cookies.count - 1
    'add cookies to response
    dim hc as httpcookie
    hc = new httpcookie(mgWebResponse.cookies.item(i).name)
    hc.expires = datetime.now.addyears(50)
    hc.path = mgWebResponse.cookies.item(i).path
    HttpContext.Current.Response.AppendCookie(hc)
    next i
    mgStreamReader.Close()
    return strText

    Catch
    'catch processing snipped
    end try
    End function



    "Beryl Small" <ber


    > wrote in message
    news:184201c3b8e3$03bbc470$...
    > Okay, I figured out how to get the value from the URL.
    > Request.Querystring works, but I don't know how to get the
    > value returned from the result of my SQL query back to
    > authorware. I need to be able to post the result to the
    > same page that executed Query. Anyone know how to do this?
    > >-----Original Message-----
    > >Hi, I have a third party software that needs to send
    > >information to an .aspx page for processing to

    > communicate
    > >with an SQL database. The software sends the information
    > >something like this:
    > >
    > >Mypage.aspx?Password=Mypassword
    > >
    > >When this request hits the page, I need to pull that
    > >variable Mypassword to use in my VB function to query the
    > >database. I'm confused on how to get it. I tried using
    > >Request.Form("password") and Request.QueryString
    > >("password") but it doesn't work. I'm also going to have
    > >to send a response back to this other software

    > (Authorware
    > >Macromedia). Anyone know how this should be done?
    > >.
    > >
     
    vMike, Dec 2, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick Zdunic
    Replies:
    0
    Views:
    929
    Nick Zdunic
    Nov 5, 2003
  2. David
    Replies:
    0
    Views:
    430
    David
    Apr 18, 2004
  3. Chris

    Third party cookies and P3P

    Chris, Apr 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    744
    David Berman
    Apr 25, 2005
  4. Wayne Berke
    Replies:
    0
    Views:
    395
    Wayne Berke
    Sep 19, 2003
  5. reju
    Replies:
    7
    Views:
    1,218
    Mark Rae
    Feb 21, 2007
Loading...

Share This Page