views:

305

answers:

1

I'm working on a legacy classic ASP interface between our client application and the server. This is not a website, just an intermediate layer in ASP (I know this is not the preferred way of doing things, told you it's legacy and it can - unfortunately - not be changed at this point).

So I'm sending a double value as a parameter on the query string like this:

http:\\localhost\virtdir\myobject.asp?f=function&1=5.25

Now in ASP, I take that value and pass it on to a method on a COM component (myobject is an instance of that COM component) using CDbl to cast the string value to a double:

myobject.DoMethod(CDbl(Request.QueryString("1")))

(Actually, I don't think I have to use CDbl here, as this will be casted implicitly because the COM method takes a double as parameter?)

My problem now is that this doesn't work if in the regional settings of the server a ',' is used as decimal separator. In that case I have to pass "5,25" on the query string to make it work.
As the client doesn't know about the regional settings of the server, is there any reliable way to make sure that a cast to CDbl will always work with the same decimal separator, regardless of the regional settings? Or is there another function like CDbl which does this? Thanks!

Edit: I now try to send the double in the body of the query in stead of in the query string, and now I have another problem for which I created a follow up question. I'm still interested in solutions to this one as well though!

+1  A: 

you could force the "current culture" using this before calling cdbl

SetLocale(1033) 
Session.LCID = 1033
Lil'Monkey
by the way you can set 1033 to something else jsut look on google for a full chart ( really easy to get)
Lil'Monkey
Nice! This is what I needed. Only `SetLocale(1033)` was enough though. No need to set `Session.LCID` as well, or would this be needed in some other obscure scenario of which I am not aware?
fretje
nope its actualy the same thing :)
Lil'Monkey