1. Georgios Papageorgiou
  2. PowerBuilder
  3. Thursday, 14 September 2017 17:56 PM UTC

Hi PowerSphere,

I have an issue (as I guess hundreds of PowerBuilder developers has if they want to use PowerBuilder as a common web service )

If I just can get access to some kind of httpRequest object..... 

Could there be a way using something from Below ?

#if defined PBDOTNET then

// From Example - works
    system.collections.ArrayList al
    al = create system.collections.ArrayList

//    using System.Net;  -- Doesnt work
//    system.net sysnet -- Doesnt work
//    sysnet = Create system.net -- Doesnt work
//    system.web.httprequest req     -- Doesnt work
//    req = system.web.httprequest -- Doesnt work

On the edge of dropping PowerBuilder for the job :(

Regards

Georgios

Accepted Answer
CRISTIAN MEDINA Accepted Answer Pending Moderation
  1. Thursday, 14 September 2017 21:55 PM UTC
  2. PowerBuilder
  3. # Permalink

string ls_error='OK',ls_val
#IF Defined PBWEBFORM THEN
 System.Web.HttpContext context
 System.Web.HttpRequest request
 System.Web.HttpCookieCollection allcook
 System.Web.HttpCookie mycook
 try
  context = System.Web.HttpContext.Current
  request = context.Request
  allcook = request.Cookies
  mycook  = allcook[as_cookie]
  ls_val  = mycook.Value
 catch (System.Exception e)
  ls_error = e.Message
 end try
#END IF
return ls_val

Comment
  1. Georgios Papageorgiou
  2. Sunday, 17 September 2017 09:13 AM UTC
Thanks !!!



Just needed to change a small thing however :)



string ls_error='OK',ls_val

#IF Defined PBDOTNET THEN

 System.Web.HttpContext context

 System.Web.HttpRequest request

 System.Web.HttpCookieCollection allcook

 System.Web.HttpCookie mycook

 try

  context = System.Web.HttpContext.Current

  request = context.Request

  allcook = request.Cookies

//   mycook  = allcook[as_cookie]  - seems it doesn't work in PB ( string as index)

  mycook  = allcook.Get (as_cookie)  // Beware it changes the logic a bit - cause it would add e cookie if it doesnt exist

  ls_val  = mycook.Value

 catch (System.Exception e)

  ls_error = e.Message

 end try

#END IF

return ls_val



Thanks again !!



Georgios



 



 

  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.