C# - Handle Different Time Zones In A Website?
Aug 16, 2010
I got this answer from Kjensen and read the answers, but this is a different webapp
I'm running scheduled events that process incoming orders, set Picking material, manage Track & Trace numbers, etc ... and I do this at a specific time of the day (set in Administration Panel)
My server is in UK (DiscountAsp.net) but I'm 2 hours ahead.
What I really wanted is, every time I call DateTime.Now that would be automatically changed to my time instead of Local Server Time. This should handle Daylight savings as well.
I thought about making a Extension to simply call DateTime.MyLocalTime and there use TimeInfo to add / subtract the correct hours.
In good old days I did this in Global.asa (ASP) ... I just wanted to know if there is a better way to handle this.
View 1 Replies
Similar Messages:
Apr 18, 2010
I'm having an issue working out how to implement this time based event. Basically, my program needs to send out an email at 12AM monday morning. But the email needs to go based on the user's local time not 12AM server time.
the problem i have discovered is Daylight savings. I used current server time as 12:00AM (my local time) and my actual offset is -7:00 UTC but after the calculation i get -6:00 utc because of daylight savings. If a user was in -7:00UTC then he/she will not get the email at 12am localtime but an hour late.
View 2 Replies
Mar 15, 2010
I am trying to create an app which shows current time in 6 time zones (Sydney, S'pore, india, london, EST and CST).
I am having troubles handling DST, because DST starts and ends on different dates in different countries.
More over I want to make it configurable (add/remove cities from the list).
Currently I have added the cities in .config with their timezone differences (with respect to GMT).
[code]....
View 3 Replies
Apr 2, 2010
I have the code:
[Code]....
[Code]....
I live in Saint-Petersburg, so s="11 : 15 : 14". What should i write in web.config or in some else place for take the similar hours?
I can't to use ToString, ToUniversalTime and change Parse arguments (it data takes from web services).
View 6 Replies
Nov 28, 2010
I am adding a custom header to a SharePoint master page and I would like to display the current time in four different time zones. However, I don't want to use the client's time as there is no way to know what time zone the client will be in, or if they have the correct time on their computer.
Ideally, the time should be displayed as follows:
Dallas: (UTC-6 w/ DST support) Zulu: (UTC) Iraq: (UTC+3) Afghanistan: (UTC+4.5)
My problem is that I really don't know anything about ASP.NET, as I'm a PHP guy myself. So I need a way to pass the serverTime as a variable that JavaScript can use to perform calculations on to display the correct time zone.
UPDATE:
I need the clock to update as each second changes. So it is a live time instead of a static time.
UPDATE 2:
This is the code I'm using.
<script runat="server">
Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
End Sub
Public Function dtBase() As Double
Dim d1 As Date = New Date(1970, 1, 1)
[Code]....
UPDATE 3:
Still don't know if the code worked. My SharePoint server rejected the page for the code blocks. I have absolutely zero idea how to do code-behind. The JS works, but if the client's time is off, the site displays incorrect times. Really wish I could just code this in PHP. I'd be done a week ago. ;)
UPDATE 4:
This update is for anyone that stumbles across this in the future looking for the answer to the problem. The code above has been updated to work correctly. The only catch is that SharePoint disallows code by default, so to enable it, you have to modify the web.config file. The web.config file is usually in the root directory of the site. Inside that file (which is XML), you'll find a tag. Somehwere inside of that, you should find , and inside of that, you should find . Inside of that tag, you want to add this:
<PageParserPath VirtualPath="/relative/path/to/your/file/here.aspx" CompilationMode="Always" AllowServerSideScript="true" />
View 3 Replies
Jun 25, 2010
How am I going to handle time input because I am having a problem especially if the user inputs greater than 24:00:00.
View 2 Replies
Jan 23, 2010
I've published a web application to a server in the USA. The app is actually for swedes (people in Sweden) and I am looking for the best way to hadle the time difference.
There's a +7 hour difference.
Should I store the DateTime.Now in DB as it is, or should I use DateDiff to change the time before creating each record?
What's the best practice here? What to store in the database? Should the date only be differed when presenting it?
View 1 Replies
Aug 23, 2010
Sometimes I am getting a time out exception when reading an XML via a URL. Is there something I can do to prevent this, or is this a problem with the remote server? Below is my simple code:
XmlDocument doc = new XmlDocument();
doc.Load(XmlReader.Create(this.RssUrl));
I do not know how to pass that setting into the code above (or if that is even the correct solution): [URL]
Exception Details: System.Net.WebException: The operation has timed out
Stack Trace:
[WebException: The operation has timed out]
System.Net.HttpWebRequest.GetResponse() +5375213
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +69
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +3929371
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +54
System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext) +144
System.Xml.XmlReader.Create(String inputUri) +8
View 1 Replies
Apr 6, 2010
I have a client request that all times be displayed in Pacific Time Zone, regardless of client settings. I'd like to avoid a scenario where I have to call a function for every time display and instead have a single point where I can make the switch.
I'm thinking a custom culture might do the trick, but I wanted to ask before I set off down a potentially blind alley (or miss something trivially easy).
View 3 Replies
Jun 14, 2010
When I press enter in my loginform, my search form at the top of the website runs instead. I'm trying to handle the enter key but I keep getting a missingmemberexception.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim getButton As New findbuttonControl
Dim vButton As Object
Dim getPassword As New findChildControl
Dim vPassword As Object
vButton = getButton.getGrandChildValue(Me.LoginView1.Controls, "Login1", "LoginButton")
vPassword = getPassword.getGrandChildValue(Me.LoginView1.Controls, "Login1", "Password")
vPassword.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + vButton + "').click();return false;}} else {return true}; ")
End Sub
View 1 Replies
Dec 1, 2010
I am in the process of putting a new site together which will make use of AJAX to pull through page content should the user have javascript enabled.
So, I am in the situation whereby every Action Method requires a check to see if the request was through AJAX or not, which is straightforward. If the request was through AJAX then I can return a partialview, if not then a full view can be returned.
With this pattern though, I'll need to create a View and a PartialView for every page on the site. The only real difference between them is going to the inclusion of the masterpage.
Am I missing a trick here is is this doubling up of views the only way to go?
I had a page that could get accessed through /site/test. Somewhere in my JS I would add a hash to the url like so #/site/test. JS would then watch for any hash changes and load the partial views as needed. If JS was not available though, an entire view would need to be returned.
So for each page I would need the view, which would then include a call to RenderPartial which would load up the partial view which would actually contain the page content. So, for every page there are two files. It just seems there should be a cleaner way of doing this.
View 1 Replies
Aug 4, 2010
I am using ASP.NET 2.0 and C#.
I have a html table, which has 2 rows and 2 columns.
I want to create web part zones for these 2 rows and 2 columns.
For each td, i want a web part zone, so that users can move data across the table.
How to create web part zones for the td?
View 2 Replies
Aug 17, 2010
I am wondering how does this website - stackoverflow handle the user authentication? It accept yahoo, google, facebook, myspace, openID etc to login. And most importantly with asp.net.I want to build something like this too.
View 1 Replies
Apr 26, 2010
We have a generic site which we deploy to clients and they personalise the text using the web parts. The problem we are currently experiencing is that they are unable to move web-parts between zones. This is not a JS issue as no errors are being thrown and this is not a CSS issue either, as we re-deployed the website here on our own server and it works perfectly fine. On our client's site, we can drag parts around in the zone it is in, however when we try to move a part out of that zone, we are given a circle cursor with a line through it. Adding parts to a zone is not an issue.
This could perhaps be linked to a previous issue of being unable to view any editable parts of a webpart. I resolved this by removing all the WebPersonalization from the WebPersonalization table in our MSSQL database.
View 2 Replies
Jan 12, 2011
I would like to achieve a nice smooth transition when the user moves controls between the WebPartZones similar to how iGoogle implements it. I've not yet been able to achieve this - the transition is very jumpy and not very smooth (I cannot use SilverLight).
Has anybody achieved this using WepPartZones without the use of SilverLight?
View 1 Replies
Feb 25, 2010
I have a WebPartZone in each of two adjacent columns. There is a gap of about 4 pixels between the two columns that I cannot remove.
I have two zones with the following markup:
[Code]....
On running the page, the relevant source code is:
<%-- End of contents and div containers for Column 1 Zone --%>
...jText at the end of this Webpart.</span>
</td></tr></tbody></table>
</td></tr></table>
</td></tr>
<tr>td style="padding:0;height:100%;"></td>
</tr></table>
</td></tr></table>
</div>
</div>
<%-- Start of div containers for Column 2 Zone --%>
<div id="ctl00_Main_MainCol2" class="box33" style="Width:39.9%;">
<div id="ctl00_Main_MainCol2Con" style="width:auto; margin-left:0.0em; margin-right:0.0em;">
<table cellspacing="0" cellpadding="0" border="0" id="ctl00_Main_ZoneCol2">
<tr><td style="height:100%;">
<%-- The following 2 tables both have cellpadding="2" which appears to be causing the problem --%>
<table cellspacing="0" cellpadding="2" border="0" style="width:100%;height:100%;">
<tr><td>
<table cellspacing="0" cellpadding="2" border="0" id="WebPart_wp1787670866" style="width:100%;">
<tr><td cellpadding="0" style="padding:0px;">
<div id="ctl00_Header_WebPartManager1_wp1787670866"></div>
<%-- Start of contents of Column 2 Zone --%>
<table cellspacing="0" cellpadding="10" style="border: thin solid #000000; background-color: #8db3e2; width:
100%;">
<thead>
</thead>
<tbody>
<tr>
<td><span style="font-size: 12px;">Text at the beginning of this WebPart....
Two of the tables, which I think are rendered by the WebPartZones, have cellpadding="2". This seems to be giving the 4 pixel gap between the columns.
View 2 Replies
Feb 20, 2011
How to keep the image transparent zones with WebImage require?
I saw that this function may require an image from a data base or from a file.
[Code]....
But when I call the image, the transparent parts changed to black.
Is there any way to keep the transparent areas of the image?
How would showing the picture in real size?
View 6 Replies
Oct 4, 2010
i m preparing a website based on asp.net forums .i have made all the forms reg., login , etchow to get the main grid which is on forums page.how to keep that updating every time.
View 2 Replies
Aug 9, 2011
I have a web site published to a Windows 2008 R2 server running IIS 7.5. The web site accesses a SQL 2008 database on a different server. The web site is accessed from an intranet.
In global.aspx users are logged in by retrieving their Windows.Identity which is passed to a stored procedure that checks they have rights to access the system. All the people trying to access the system have rights to the system and if I run the stored procedure with their various Windows.Identities passed as the parameter - it returns that they are authorized.
I have admin rights on the web server. If I browse the site from my box it works okay. If another user who has admin rights on the server browses the site (at the same time as me - or on their own) it works okay.
If someone without admin rights to the server browses the site - and they are the only person 'on' the site - it works okay. If a second person tries to browse the site at the same time as the first person is logged in ... nothing happens. The progress bar in the browser just sits there forever. No errors etc.
So, no-one using the site ... Fred types http://server1/system1/ into his browser and the site works okay.
Jim types http://server1/system1/ into his browser and nothing happens.
Fred logs off and Jim tries the site again. Works fine for Jim this time.
View 5 Replies
Apr 16, 2012
I am wondering how I could implement a timeout feature in my website when after a period of non-inveracity from the user for example 20 minutes then this will redirect back to a timed out page? I'm using VB 2010
View 1 Replies
Jun 3, 2010
I'm looking for a way to put real time features into my web site. The idea is asynchronous communication between 2 people - like a chat session. If I use the chat example - I'd like the second person to know that the first one has sent a message to him, without refreshing or doing something active on the web page. Polling is not a good idea here - so is there any other solution? the back-end could be ASP.NET or PHP (ASP.NET preferred).
View 3 Replies
Mar 14, 2010
how to calculate the time the visitor has been on the website?
View 3 Replies
May 26, 2010
iam geting Time out expired for my website .This is happending when more users accessing the site . so how can i resolve this issue .rectify this issue. But it is not problem with connection pooling
View 2 Replies
Jan 22, 2010
I have noticed two time-related problems with my website:
[1] Slowness of loading the graphics for each page in the browser;
[2] Receiving a "Runtime Error" page in the browser when I do take action on the site (e.g. navigate to another page) within approx. 30 seconds.
Are these problems related to limitations of my web host?
View 3 Replies
Feb 28, 2010
This is my approach : I reserve last time that a user post a postback to server in a session and in every postback subtract this value from current value. Is there a better way for this?
View 1 Replies