[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RubyScript (ASP) - getting server variables

Tim Morgan

5/9/2006 10:29:00 PM

I haven't seen hardly anything about Ruby as the scripting engine for
ASP (Microsoft's ASP -- not Ruby/ASP -- see here:
http://www.exactlyoneturtle.com/wordp...), but I have to try...

I'm using Ruby as the language for my ASP script. When I do the
following, I get "/my_script.asp" output to the html:

<%= Request.ServerVariables.item('SCRIPT_NAME') %>

However, if I try to treat this value as a String, I get weird stuff
happening. Basically, the following returns something like
"#<WIN32OLEEX:0x1822e10>" instead of "/my_script.asp":

<%= Request.ServerVariables.item('SCRIPT_NAME').to_s %>

So, the object returned by OLE isn't a string. Doing a .methods()
doesn't give me anything to work with either. ASP knows how to make it
into a string, obviously, so why can't I?

Please, someone with that mysterious OLE knowledge, throw me a bone
here. I just need to know how to get a *String* object instead of this
funky OLE object.

5 Answers

Gavin Kistner

5/10/2006 11:20:00 PM

0

Tim Morgan wrote:
> However, if I try to treat this value as a String, I get weird stuff
> happening. Basically, the following returns something like
> "#<WIN32OLEEX:0x1822e10>" instead of "/my_script.asp":

You sometimes get that same weirdness using JS ASP, too. I believe the
object returned by request has a .Value() method that will return the
true value of the object.

Tim Morgan

5/11/2006 2:06:00 PM

0

I tried that and many other variations on that theme (different
capitalization, abbreviations, etc.), with no luck. They all return a
"method name not found" or similar error.

Anyway, I ended up rewriting my script in plain ol' ASP, so I don't
have to know the answer, though it sure would be nice to find out.

Dave Burt

5/11/2006 2:40:00 PM

0

Tim Morgan wrote:
> ... Basically, the following returns something like
> "#<WIN32OLEEX:0x1822e10>" instead of "/my_script.asp":
>
> <%= Request.ServerVariables.item('SCRIPT_NAME').to_s %>
>
> So, the object returned by OLE isn't a string. Doing a .methods()
> doesn't give me anything to work with either. ASP knows how to make it
> into a string, obviously, so why can't I?

What does .ole_methods give you?

Cheers,
Dave

Sam Smoot

5/11/2006 6:37:00 PM

0

Maybe to_s()?

Tim Morgan

5/12/2006 9:11:00 PM

0

Thank you Dave. Using .ole_methods() gave me a list of things to try. I
tried each one, and found .Item(), and it works!

Sam, to_s() just returned something like #<123456>.