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
LVL 46
fritz_the_blankAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

amit_gCommented:
If the application use Session the easiest way would be to set Session.LCID in Session_OnStart event in global.asa. If not use AspLCID property in IIS6 metabase http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/b17ca54c-1810-4c5e-9e7a-ed58b051f5e0.asp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fritz_the_blankAuthor Commented:
Thank you for your post.

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

FtB
amit_gCommented:
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.
 Acronis Global Cyber Summit 2019 in Miami

The Acronis Global Cyber Summit 2019 will be held at the Fontainebleau Miami Beach Resort on October 13–16, 2019, and it promises to be the must-attend event for IT infrastructure managers, CIOs, service providers, value-added resellers, ISVs, and developers.

fritz_the_blankAuthor Commented:
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
amit_gCommented:
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)?
fritz_the_blankAuthor Commented:
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
Michel SakrRounded IT Consultant / Projects manager / Cloud Consultant / IT PlanningCommented:
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)
fritz_the_blankAuthor Commented:
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
fritz_the_blankAuthor Commented:
Okay, after a day of testing, changing the ASPLCID seems to do what I want it to.

Thanks to all,

FtB
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.