Link to home
Start Free TrialLog in
Avatar of fritz_the_blank
fritz_the_blankFlag for United States of America

asked on

Force IUSR_ to use regional settings

Is there any way to force IIS to the regional settings for ASP applications? I see a fix here for Server 2000:

http://support.microsoft.com/default.aspx/kb/306044

but I am running Server 2003 and the registry settings are different.

The issue is that using Date() or Now() methods currently give unpredictable results whereas they worked fine before on NT 4.0.

I realize that I can get around this via code or by putting an LCID code on each page, but I was hoping to avoid doing so.

Thank you,

Fritz the Blank
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fritz_the_blank

ASKER

Thank you for your post.

I changed the value in the metabase to 2057. Do you think that should solve the problem?

FtB
The way you are asking, it seems it did not :)

It should. AFAIK, IIS6 doesn't require restart for metabase changes (may be that is also customizable setting) but just to be on safe side do a restart.
I changed the value in the metabase and recycled IIS. What I am doing now is that we record the date and time of logins. So, I now have two fields in the table and the values look like this:

      Dim strDateNow
      ' explicitly format date to lessen month/date transposition error
      strDateNow = "#" & FormatDateTime(Now(), 1) & " " & FormatDateTime(Now(), 3) & "#"
      objCommand.CommandText = "INSERT into tblTraffic (intUserID,datLoggedIn,datLoggedIn2) VALUES (" & Session("IntUserID") & "," & strDateNow & ",'" & Now() & "')"
      objCommand.Execute()


So far, the two columns are recording the same data. This is good because I was getting something quite different earlier:

38067      06/09/2005 16:29:11          
 38066      06/09/2005 16:26:30          
 38065      06/09/2005 16:25:41          
 38064      06/09/2005 16:23:33          
 38063      06/09/2005 16:19:23          
 38062      06/09/2005 16:15:59          
 38061      06/09/2005 16:13:57          
 38060      06/09/2005 16:13:52          
 38059      06/09/2005 16:12:31          
 38058      06/09/2005 16:12:09          
 38057      06/09/2005 16:12:07          
 38056      09/06/2005 16:10:22          
 38055      09/06/2005 16:07:55          
 38054      06/09/2005 16:05:55          
 38053      06/09/2005 16:05:20          
38054      06/09/2005 16:05:55          
 38053      06/09/2005 16:05:20          
 38052      09/06/2005 16:05:06          
 38051      09/06/2005 16:02:07          
 38050      06/09/2005 15:57:17          
 38049      06/09/2005 15:56:45          
 38048      09/06/2005 15:48:09          
 38047      09/06/2005 15:44:24          
 38046      09/06/2005 15:42:51          
 38045      09/06/2005 15:40:09          
 38044      09/06/2005 15:34:30          
 38043      09/06/2005 15:33:48          
 38042      09/06/2005 15:32:11          
 38041      09/06/2005 15:23:27          
 38040      09/06/2005 15:22:01          

what was happening there is that Now() was inserting 06/09 and 09/06, and I couldn't understand why that should be the case given that the code was all server-side and that the regional settings were all set for UK. The article that I posted above (http://support.microsoft.com/default.aspx/kb/306044) pointed me in the right direction but was inapplicable for Server 2003. Implementing your suggestion, here is what I have now:


38263       11/06/2005 19:55:16       11/06/2005 19:55:16            
 38262       11/06/2005 19:54:36       11/06/2005 19:54:36            
 38261       11/06/2005 19:47:57       11/06/2005 19:47:57            
 38260       11/06/2005 19:35:53       11/06/2005 19:35:53            
 38259       11/06/2005 19:24:54       11/06/2005 19:24:54            

So far so good....

FtB
That is little puzzling to me. As you said, this all is server side so Now() should be writing in UK format. The only thing I can think of is that the server was initially setup to US format and later the regional settings were changed to UK.

Did you check Response.Write strDateNow & "," & Now() (before the metabase change)? What was it?

Where is the ACCESS database? On the same server? Could it be ACCESS thing? Did you create the ACCESS database in your machine (in US) and then transferred to remote machine (UK)?
The access database is on the same server as the web site, both of which are in the UK.

>>The only thing I can think of is that the server was initially setup to US format and later the regional settings were changed to UK.<<

That is the case, but the regional settings for UK were set some weeks ago (wth a reboot just to make sure). I was very surprised to see Now() alternately insert 06/09 and 09/06 in such a short space given alll of the activity came through the IUSR account....


>>Did you check Response.Write strDateNow & "," & Now() (before the metabase change)? What was it?<<

I didn't because I saw what was being written the table.

Since I have made the change, you can see that the unabmiguous date format and Now() are inserting the same values, at least so far. It is my hope that it will continue to do so!

FtB
for portability you have to put it in the code..
Otherwise you will have to login to the server as IUSR_webservername and set the settings you want(You will have to change the account password)
Silvers5--

Thank you for posting.

In order to do that then, I would need to set a temporary password for the IUSR account and then log in that way?

Doesn't setting the ASPLCID in the metabase accomplish the same thing?

FtB
Okay, after a day of testing, changing the ASPLCID seems to do what I want it to.

Thanks to all,

FtB