On my Windows Server 2008 R2 server, I've set the:
"Region and Language" -> "Formats" -> "Danish (Denmark"
When I see the settings here, and when I click the "Additional Settings", it seems correct. However, in my application, it is not set correct. Here my output is still American.
For instance, these two situations I get the problem:
Datetime.ToString() gives 11/4/2012 1:18:38 PM instead of 04/11/2012 13:18:38 .
When I input a double with 50,00 it is ignored and is set to 5000. When using a dot, it works. it should be a decimal
Of course I could all set this in the application specifically, but I wonder why it is set to English as default when I've set the Formats to Danish.
I've also set the following:
Location = "Denmark"
Default Input Language = "Danish"
How do I fix it? :-)
ASP.NET runs under a different user account, so you'll need to copy the regional settings across.
In the Region and Language control panel, on the Administrative tab, you should have a Copy settings... button. This will copy the settings from your account to the welcome screen, system accounts and new user accounts.
Another thing to check would be the <globalization> section in your web.config file - you might be picking up the culture settings from the user's browser.
Related
I am not very familiar with IIS7 and I need to create a server variable so that I can access it within my PHP code. I can easily accomplish this in Apache by using:
SETENV variable_name variable_value
in the .htaccess file. However accomplishing this in IIS seems to be a bit of a secret. I have looked online for info and the closest thing I can find states using the URL Rewrite Module using these steps:
Clicking on View Server Variables
Click the Add link and enter the variable name
Go back to rules and click the View Rewrite Maps
Click Add Rewrite Map and enter the default value.
Restarted the server.
Full docs can be found at: http://www.iis.net/learn/extensions/url-rewrite-module/setting-http-request-headers-and-iis-server-variables
I followed that but it still doesn’t work. Any ideas how this is done? Is it even possible to do this in IIS? All I want to do is set up a server variable with a static value.
example: $_SERVER['MY_VARIABLE']
Thanks.
In IIS Manager click on your machine, open the "URL Rewrite" icon from the "IIS" icon group.
Under "Actions" (on the extreme right) click the innocuous little "View Server Variables" link, disregarding "Manage Server Variables"
In the "View Server Variables" screen's "Actions" (on the extreme right) click "Add..."
I solved this by using the PHP auto_prepend_file directive. More information can be found here: http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file
Just create a file that adds the desired value to the $SERVER array, set that as the auto_prepend_file and you are good to go. This will work with any server, not just IIS.
The other answers clearly work, but seems messier than the way I found.
Go to FastCGI settings, where you have the PHP exe configured (per the original question)
Right click on ...\php-cgi.exe, select "Edit"
Then choose the ellipses next to "Environment Variables"
Then you can click add/remove and edit your variables.
I have a weird issue here, and I'm not sure if its ASP.NET versions, IIS, or me doing something stupid (experience tells me its probably item 3.)
I have 2 websites that worked fine on w2k3, 1 is ASP.NET 1.1, and the other 2.0, with the currency being displayed correctly on web pages.
Since migrating these to a w2k8 box and IIS 7 I have an odd issue where the 1.1 site is now displaying $ rather than the local currency that the user browses to. But the 2.0 site works fine.
Both have IIS set to the same globalisation. (No culture, Client is false, UI Culture is English (en)).
Both sites are hosted on the same server, the only differences I can see are that;
1 binds using <Databinder.Eval(... Price, "{0:c}")> and the other binds to a property that uses String.Format("{0:c}");
So being as the code has not changed I feel that it is an IIS issue. But as both sites have the same globalisation settings in IIS I don't see that it can be.
So, anyone know whats goign on and how to solve it?
Running IIS 10 site that was developed on a UK machine server 2012 was moved to a GCP default build server 2016 which comes US "out of the box".
On the website $ signs appear where £ signs used to.
I changed everything I could in Settings > Region and Language. UK language, keyboard, Update & Security, Drive on Left etc. Absolutely nothing made any difference.
Finally found it in Control Panel > Region. After adding English UK as a display language (and gettting rid of US English)
I needed to go to Adminstrative Tab, Welcome Screen and new User Accounts. Copy the settings.
Now the site is finally displaying correct currency symbol.
Check the Regional and Language options from control panel on the new server and make sure they match the like setting on the old box.
AFAIK, at least String.Format("{0:c}") and probably <Databinder.Eval(... Price, "{0:c}")> as well will use whatever the value of property System.Threading.Thread.CurrentCulture is.
It does not matter whether or not you set it on the page, the value will be assigned to it anyway. And it is pretty reasonable to think, that these settings will come from server settings, which from your description seems to be en-US. Thus $ as currency sign... You might ask yourself why it was working before...
Well, are you sure that you have copied all the configuration files?
Another clue might be, that you have emulated version of .Net 1.1 rather than the real one on your new box. It might be not 100% compatible...
I have an installable ASP.Net application that is logging using Common.Logging.
When writing log messages ie:
_log.InfoFormat(CultureInfo.???, "{0}: Writing to the Log", DateTime.UtcNow);
I am confused about which culture I should be using. The result I want is that the log messages are formatted using the server's regional settings. That way when administrators install the application they have control over how their log messages are formatted.
There are fours options but none seem to be the correct choice:
CultureInfo.CurrentCulture: this seems like it would be the correct choice for a windows app but ASP.Net is changing this to match the user browsing the site - so it's appropriate for formatting content to display to the user but not for writing to the log.
CultureInfo.CurrentUICulture: similar problems to CurrentCulture - will match the current user browsing the site.
CultureInfo.InstalledUICulture: the system installed culture - appears to relate to the copy of windows installed but not alterable by the user. Apparently this one is a bit useless
CultureInfo.InvariantCulture: this is not user configurable. I am wondering if this is the best of the four options here though because at least it is consistent and won't vary by who is browsing the site/the media windows was installed from.
I am left wondering if I need to add explicit configuration in my web.config for the system culture so the installer can choose a culture. The answer I really want is whatever CultureInfo.CurrentCulture was before ASP.Net changed it to match the current user.
Note: I know I can turn off ASP.Net changing the CurrentCulture per user but the UI relies on this behaviour.
Admins like to have control over the logs. Telling them to go configure their server culture so that the logs are in a particular format doesn't seem like the best solution to me.
Adding a configuration option into web.config is a good idea. This will let the admin configure the log format as required.
Rather than ask the user, you could make an intelligent guess while installing using CultureInfo.CurrentCulture. If the user wants it to be something different, he can always change it.
If you do want to take it from CultureInfo.CurrentCulture rather than configuration, you can pick it during the Application_Start event, and keep it in the application context.
I have date format in my local machine : (d/M/yyyy h:mm tt) ==> (23/6/2011 4:30 PM)
when i publish my website on IIS server it converts date format to (M/d/yyyy H:mm)
i changed the date and time formats of the server but it's not affected .
i changed the culture of the website to English US time format solved but date not. (M/d/yyyy hh:mm tt)
i changed the culture of the website to English UK date format solved but time not. (d/MM/yyyy H:mm)
what is the solution to make it's format like my local format ???!!!
- Open IIS 7
- Select your website
- Open .NET GLOBALIZATION
- From Culture tab, select required Culture and UI Culture.
- Do iisreset
Go to Control Panel
Click Region and you will see a screen with 3 tabs (Formats, Location and Administrative)
Click Formats and choose the settings you prefer
Click Location and choose the settings you prefer
Click Administrative tab. For "Welcome screen and new user accounts", click copy settings. From the new window, click both checkboxes for 'welcome screen and system accounts' and 'new user accounts' (if you skip this step, you will still see the issue because IIS uses system account)
Approve all changes for Region by clicking Ok on all open windows
Open Command prompt, write iisreset and enter
If you still don't see the changes try logoff and logon
I was having the same problem, I just found a solution, you need to change the key on the server, follow this steps:
Go into Registry Editor (start -> run -> type regedit).
Get into the folder HKEY_USERS -> .DEFAULT -> Control Panel -> International.
Look for the key sShortDate, right click -> Modify...
Change the Value data for d/M/yyyy.
Log off. Then next time you log in, dates should be work as you wanted.
That should do the trick, you can also change the sLongDate.
Try to put this line in the system.web of the web.config, modify the data of culture to your country.
<globalization uiCulture="es-CO" culture="es-CO" enableClientBasedCulture="false" />
Please try the below steps.Its works for me
Check app pool of your application in IIS.
Go to Application pool of your website and change Identity of that pool to local service(because your desired date format you have set is in your local system) in Advance setttings.
Restart your app in IIS
This is based on Nedim answer, but with tweak:
Go to Control Panel
Click Region and you will see a screen with 3 tabs (Formats, Location and Administrative)
Click Formats and choose the settings you prefer
Click Additional settings
Click Date tab
Change Short date to desired format and confirm dialog
Click Location and choose the settings you prefer
Click Administrative tab. For "Welcome screen and new user accounts", click copy settings. From the new window, click both checkboxes for 'welcome screen and system accounts' and 'new user accounts' (if you skip this step, you will still see the issue because IIS uses system account)
Approve all changes for Region by clicking Ok on all open windows
Open Command prompt, write iisreset and enter
If you still don't see the changes try logoff and logon
In my case the default format for my country was wrong and I couldn't pick proper format except choosing someting else with desired format. But there was web.config with globalization set to my local culture which had precedense.
Even after setting application locale it was still picking up the application pool users locale. I had to change the region settings for all users. This screen shot might help...
Change System Locale
Change Region Settings to desired
Change your system short date and log date format as desired.
Check app pool of your application in IIS.
Go to Application pools section of IIS and change Identity of that pool to local system(because your desired date format you have set is in your local system)
Restart your app in IIS
If you have changed you system date format and Clicked on Copy Settings to ALl User accounts and still your new format not getting applied to IIS hosted WebProject.Than you must try to go to APplication Pool Idnetity and Change the User Account and then again try to copy settings to All User accounts. Get reference from here it worked for me
How to Set date and time format in IIS
I have an ASP.Net website running on IIS7. The developers have created a CMS in the \admin folder, which allows the website admin to create/edit/delete pages.
They have said:
"The read/write permission should be given to the user that requires login access to the admin panel, not the anonymous user that has general public access to the website. The reason for the write permission is to allow the administrator to be able to upload images and files through the CMS, and make various changes to the navigation, style sheet, etc".
Also, they have said:
"Password protect the /admin folder and assign full rights to your admin user as it needs to update data (site files) accordingly as mentioned in the Folder level section above. For certain modules to work, such as the file manager, you would need to use Basic Authentication at the Directory Security level. The FCKeditor folder also should be protected so it has the correct permissions. "
Is this approach safe? I have tried assigning full rights to the Plesk protected folder user (the \admin folder is protected through Plesk), but Plesk keeps reverting back to its default settings. I am told this is a security measure, which makes sense.
What would an alternate way of accomplishing this be without rewriting any code?
If the application needs the ability to upload then it will always need read/write permissions to the directories it is going to upload to - no amount of rewriting will change this, it's part of the basic functionality. The same applies to editing stylesheets etc.
Reverting changes you make sounds like a very bad security measure - warning you would be fine, but generally you make these changes for a reason and want them to stay.
Hay try this...
Right-click the file and select Properties.
Click on the Security tab.
Click Advanced in the lower right.
In the Advanced Security Settings window that pops up, click on the Owner tab.
Click Edit.
Click Other users or groups.
Click Advanced in the lower left corner.
Click Find Now.
Scroll through the results and double-click on your current user account.
Click OK to all of the remaining windows except the first Properties window.
Select your user account from the list up top and click Edit.
Select your user account from the list up top again and then in the pane below, check Full control under Allow, or as much control as you need.
You’ll get a security warning, click Yes.
On some files that are essential to Windows, you’ll get a “Unable to save permission changes… access is denied” warning and there’s nothing that you can do about it to the best of my knowledge.
Reconsider why you’re using Windows.