ASP.NET Web应用程序请求期间文化莫名其妙地改变 [英] Culture changing inexplicably during ASP.NET web application request

查看:103
本文介绍了ASP.NET Web应用程序请求期间文化莫名其妙地改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,当从何处日期字段修改的日期格式,从2009年4月16日上午12点00分00秒至16/04/2009为00:00:00。我设置应用程序写出来的每一个存储过程具有相同相应日期字段解雇,如果它存在。下面就是走了出来。你会发现,格式转换,通过莫名的一半。

 执行uspContent_SelectOne'132'
4/16 / 2009年上午12点00分00秒
EXECUTE uspContent_SelectOne'127'
2009年4月16日上午12点00分00秒
EXECUTE uspContent_SelectOne'133'
2009年4月16日12 :00:00
EXECUTE uspContent_SelectOne'131'
2009年4月16日上午12时00分00秒
EXECUTE uspAttachment_SelectAll
EXECUTE uspArticleAuthors_SelectAll_ArticleId'3'
EXECUTE uspArticles_SelectOne 3
EXECUTE uspAuthors_Letters
EXECUTE uspAuthors_Letters
EXECUTE uspAuthors_Letters
EXECUTE uspAuthors_SelectAll_Letter_LastName'A'
EXECUTE uspFiles_SelectAll_NoFileData
EXECUTE uspArticles_SelectOne'3'
EXECUTE uspArticleTypes_SelectAll
EXECUTE uspFiles_SelectAll_NoFileData
EXECUTE uspAuthors_SelectOne'0'
EXECUTE uspArticleAttachments_SelectAll_ArticleId'3'
EXECUTE uspArticleAttachments_SelectOne_ArticleId_AttachmentId'3','4'
EXECUTE uspAttachment_SelectOne'4'
EXECUTE uspContent_SelectOne'132'
16/04/2009 00:00:00
EXECUTE uspContent_SelectOne'127'
16/04/2009 00:00:00
EXECUTE uspFiles_SelectOne_NoFileData 60'
EXECUTE uspArticleAttachments_SelectOne_ArticleId_AttachmentId'3','3'
EXECUTE uspAttachment_SelectOne'3'
EXECUTE uspContent_SelectOne'133'
16/04/2009 0点00分00秒
EXECUTE uspContent_SelectOne'131'
16/04/2009零时00分00秒
EXECUTE uspAttachment_SelectAll
EXECUTE uspArticleAuthors_SelectAll_ArticleId'3'
EXECUTE uspAuthors_SelectAll_Letter_LastName'A'
EXECUTE uspContent_SelectOne '129'
18/09/2008 00:00:00
EXECUTE uspContent_SelectOne'7'
18/09/2008 00:00:00
EXECUTE uspContent_SelectOne'8'
18/09/2008 0时00分00秒
EXECUTE uspContent_SelectOne'9'
18/09/2008 0时00分00秒
EXECUTE uspContent_SelectOne'10'
18 / 09/2008 0时00分零零秒
EXECUTE uspContent_SelectOne'11'
18/09/2008 0时00分零零秒
EXECUTE uspFiles_SelectAll_NoFileData

我想不通为什么。我使用的是ASP.NET/C#,SQL Server 2005中,和MS企业库4.1。



更新1



我查了应用程序的区域性设置和得到这个。对于每一个日期字段查询我查了一下文化。在下面的截图可以看到文化离我们如何改变英国:



百家姓变化的图像/



在它设置为web.config中的设置如下:

 <全球化文化=EN-US的UICulture =EN-USrequestEncoding =utf-8的ResponseEncoding =UTF-8enableClientBasedCulture =FALSE/> ; 


解决方案

是从请求不同的浏览器来?你从HTTP请求的Accept-Language头拿起文化/的UICulture?如果是这样,它可能是你有一个浏览器已经它的首选语言设置为en-US,另一套为en-GB?


I'm having a weird issue when where the date format of from the date fields changes from 4/16/2009 12:00:00 AM to 16/04/2009 00:00:00. I set the application to write out each stored proc that fired with the same corresponding date field if it exists. Here's what came out. You'll notice that the format switch inexplicable half way through.

EXECUTE uspContent_SelectOne '132'
4/16/2009 12:00:00 AM
EXECUTE uspContent_SelectOne '127'
4/16/2009 12:00:00 AM
EXECUTE uspContent_SelectOne '133'
4/16/2009 12:00:00 AM
EXECUTE uspContent_SelectOne '131'
4/16/2009 12:00:00 AM
EXECUTE uspAttachment_SelectAll
EXECUTE uspArticleAuthors_SelectAll_ArticleId '3'
EXECUTE uspArticles_SelectOne '3'
EXECUTE uspAuthors_Letters
EXECUTE uspAuthors_Letters
EXECUTE uspAuthors_Letters
EXECUTE uspAuthors_SelectAll_Letter_LastName 'A'
EXECUTE uspFiles_SelectAll_NoFileData
EXECUTE uspArticles_SelectOne '3'
EXECUTE uspArticleTypes_SelectAll
EXECUTE uspFiles_SelectAll_NoFileData
EXECUTE uspAuthors_SelectOne '0'
EXECUTE uspArticleAttachments_SelectAll_ArticleId '3'
EXECUTE uspArticleAttachments_SelectOne_ArticleId_AttachmentId '3','4'
EXECUTE uspAttachment_SelectOne '4'
EXECUTE uspContent_SelectOne '132'
16/04/2009 00:00:00
EXECUTE uspContent_SelectOne '127'
16/04/2009 00:00:00
EXECUTE uspFiles_SelectOne_NoFileData '60'
EXECUTE uspArticleAttachments_SelectOne_ArticleId_AttachmentId '3','3'
EXECUTE uspAttachment_SelectOne '3'
EXECUTE uspContent_SelectOne '133'
16/04/2009 00:00:00
EXECUTE uspContent_SelectOne '131'
16/04/2009 00:00:00
EXECUTE uspAttachment_SelectAll
EXECUTE uspArticleAuthors_SelectAll_ArticleId '3'
EXECUTE uspAuthors_SelectAll_Letter_LastName 'A'
EXECUTE uspContent_SelectOne '129'
18/09/2008 00:00:00
EXECUTE uspContent_SelectOne '7'
18/09/2008 00:00:00
EXECUTE uspContent_SelectOne '8'
18/09/2008 00:00:00
EXECUTE uspContent_SelectOne '9'
18/09/2008 00:00:00
EXECUTE uspContent_SelectOne '10'
18/09/2008 00:00:00
EXECUTE uspContent_SelectOne '11'
18/09/2008 00:00:00
EXECUTE uspFiles_SelectAll_NoFileData

I can't figure out why. I'm using the ASP.NET/C#, SQL Server 2005, and the MS Enterprise Library 4.1.

UPDATE 1

I checked the culture settings of the app and got this. For every date field query I checked the culture. In the screen shot below you can see how the culture changes from US to UK:

The setting in the web.config it's set as follows:

<globalization culture="en-US" uiCulture="en-US" requestEncoding="utf-8" responseEncoding="utf-8" enableClientBasedCulture="false" />

解决方案

Are the requests coming from different browsers? Are you picking up the Culture/UICulture from the Accept-Language header in the HTTP Request? If so, it is possible that you have one browser that has it's preferred language set to en-US and another set to en-GB?

这篇关于ASP.NET Web应用程序请求期间文化莫名其妙地改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆