| | |
Business Entity project not affected by Globalization in the web.config of the Web Pj
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2007
Posts: 56
Reputation:
Solved Threads: 1
Business Entity project not affected by Globalization in the web.config of the Web Pj
0
#1 Aug 19th, 2009
Hi,
I have 2 projects, the business entity, there I have all the classes mapped from the database and the web project where I fill those business entity classes. Then, I need to store in a DB. I have the globalization set in the web.config on the web project. (VS2008, NET 3.5, SQL 2005)
My problem is when I have an instance of the BE class, and I have a date attribute on it, the value entered is not formatted according the globalization in the web.config, and obviously when I pass to the class to store in the DB it fails due to date format.
I think is missing some configuration... but I googled for it and no luck.
There you have part of my coding:
Business Entity:
Web Project (WebSite)
web.config
Thanks!
I have 2 projects, the business entity, there I have all the classes mapped from the database and the web project where I fill those business entity classes. Then, I need to store in a DB. I have the globalization set in the web.config on the web project. (VS2008, NET 3.5, SQL 2005)
My problem is when I have an instance of the BE class, and I have a date attribute on it, the value entered is not formatted according the globalization in the web.config, and obviously when I pass to the class to store in the DB it fails due to date format.
I think is missing some configuration... but I googled for it and no luck.
There you have part of my coding:
Business Entity:
vb Syntax (Toggle Plain Text)
Public Class Categoria Inherits AuditBaseClass Private _categ_id As String Private _categ_descripcion As String Private _categ_tipo_item As Integer Private _categ_parent As String Private _categ_estado_registro As Char Private _creado_usuario As String Private _creado_fecha As DateTime Private _modificado_usuario As String Private _modificado_fecha As DateTime [...] Public Property creado_fecha() As DateTime Get Return Me._ creado_fecha End Get Set(ByVal value As DateTime) Me._ creado_fecha = value End Set End Property [...] End Class
Web Project (WebSite)
vb Syntax (Toggle Plain Text)
Private Sub guardar_datos() Dim oCategoriaWCF As New definiciones.DefinicionesClient '<--- Class to store in DB Dim oCategoriaBE As New BE.Categoria '<--- Object with the Date Attribute Dim result As Integer = -1 oCategoriaBE.id = CInt(Session.Item("data.id")) oCategoriaBE.categ_descripcion = Me.txtDescripcion.Text.Trim oCategoriaBE.categ_tipo_item = Me.ddlTipoItem.SelectedValue oCategoriaBE.categ_parent = Me.ddlParent.SelectedValue.Trim If oCategoriaBE.id = Nothing Or oCategoriaBE.id = 0 Then oCategoriaBE.creado_usuario = Session.Item("gen.user_name") oCategoriaBE.creado_fecha = Now() '<--- Now() method returns the incorrect date format and also the value stored Else oCategoriaBE.modificado_usuario = Session.Item("gen.user_name") oCategoriaBE.modificado_fecha = Now() '<--- Now() method returns the incorrect date format and also the value stored End If Try result = oCategoriaWCF.GuardarCategoria(oCategoriaBE) '<---- this method fails when it tries to store in the DB Catch ex As Exception result = -2 Finally oCategoriaWCF.Close() End Try If result > 0 Then Me.lblResponse.Text = "Los datos fueron guardados satisfactoriamente" carga_datos() limpiar_controles() Else Me.lblResponse.Text = "Hubo un error al guardar los datos" End If oCategoriaWCF = Nothing End Sub
web.config
xml Syntax (Toggle Plain Text)
<system.web> <globalization requestEncoding="ISO-8859-1" responseEncoding="ISO-8859-1" uiCulture="es-PE" culture="es-PE" /> </system.web>
Thanks!
Re: Business Entity project not affected by Globalization in the web.config of the Web Pj
0
#2 Aug 20th, 2009
I never found a solution to the exact same problem you're having. I had a BE project that did transaction posting to a payment gateway and I tested it on a winform application and it worked perfectly .. then when I used it from a web application assembly it failed and I spent hours to figure out that the web apps and desktop apps format differently.
I never found a solution using localization. I began explicitly calling the .ToString() with the desired DateFormat options. The number of decimal places, separator, etc also varied between the desktop and web apps.
I never found a solution using localization. I began explicitly calling the .ToString() with the desired DateFormat options. The number of decimal places, separator, etc also varied between the desktop and web apps.
![]() |
Similar Threads
- Update Web.config from windows application (ASP.NET)
- web config (ASP.NET)
- database string in web.config not working (ASP.NET)
- Web Config file error (ASP.NET)
- urgent: session timeout occurs unexpectedly(given both web.config & global.asax code) (ASP.NET)
- Difference between Web.Config and Machine.Config (C#)
- wat is web.config (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: Getting mac address and client side encryption
- Next Thread: Where to put Google Analytic code?
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox commonfunctions control dataaccesslayer database datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview gridview gudi iis image javascript listbox login microsoft mobile mono mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers






