473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Date string problem in query string when posting back

Hi,

I posted last week about a problem I've got and didn't get any responses,
but I've managed to come up with a workaround and a possible cause
(guessing). I was wondering if someone could confirm my theories and give me
some information on the proper way to handle this.

I have a search results web page that is opened with info in the query
string. It's handled fine by asp.net, but when the user navigates away from
the page then goes back to it, the query string does not return the expected
results e.g.

http://localhost/GSContracts/SearchR...ateTo=29/08/07

When going to the page first time, the query string returns values as seen,
but when going back to the page dateFrom returns "" and dateTo returns
Nothing.

I've guessed that it's something to do with the fact that a post back is
processed through javascript and javascript may not recognise the /
character?? Like I said, total guesswork... so I've used some shared global
variables in my application to get around this problem.

This works fine, but I'm sure there's a more elegant solution? Perhaps, if
I'm right, there's a format I should be using for dates in query strings, so
javascript can process it?

Thanks in advance.
Aug 29 '07 #1
5 2343
What if you check the raw url ? It would first allow to check if query
string parameters are totally cleared or if they are still there but have
some problem for reading them...
The method you are using to "return back" to this page (this is nothing else
than a postback ?) may also help.

Also the culprit could perhaps be the / character. Is 00/00/00 expected ? It
looks a bit weird for a date ?

Let us know if you are still stuck so that we can try a repro if needed (I
don't remember to have noticed this but I generally pass only numbers).

---
Patrice

"Julia B" <Ju****@discussions.microsoft.coma écrit dans le message de
news: C9**********************************@microsoft.com...
Hi,

I posted last week about a problem I've got and didn't get any responses,
but I've managed to come up with a workaround and a possible cause
(guessing). I was wondering if someone could confirm my theories and give
me
some information on the proper way to handle this.

I have a search results web page that is opened with info in the query
string. It's handled fine by asp.net, but when the user navigates away
from
the page then goes back to it, the query string does not return the
expected
results e.g.

http://localhost/GSContracts/SearchR...ateTo=29/08/07

When going to the page first time, the query string returns values as
seen,
but when going back to the page dateFrom returns "" and dateTo returns
Nothing.

I've guessed that it's something to do with the fact that a post back is
processed through javascript and javascript may not recognise the /
character?? Like I said, total guesswork... so I've used some shared
global
variables in my application to get around this problem.

This works fine, but I'm sure there's a more elegant solution? Perhaps, if
I'm right, there's a format I should be using for dates in query strings,
so
javascript can process it?

Thanks in advance.

Aug 29 '07 #2
On Aug 29, 3:44 pm, Julia B <Jul...@discussions.microsoft.comwrote:
I've guessed that it's something to do with the fact that a post back is
processed through javascript and javascript may not recognise the /
character?? Like I said, total guesswork... so I've used some shared global
Would be good to the code where you do it

In general, / has to be passed as %2F and then decoded in the asp.net
code using HttpUtility.UrlDecode if necessary

Aug 29 '07 #3
"Julia B" <Ju****@discussions.microsoft.comwrote in message
news:C9**********************************@microsof t.com...
This works fine, but I'm sure there's a more elegant solution? Perhaps, if
I'm right, there's a format I should be using for dates in query strings,
so
javascript can process it?
Yes, definitely!

Firstly, you're quite right about the forward slash character - try to avoid
that if you possibly can - hyphens are nomally good in URLs and
QueryStrings...

Secondly, you need to make sure that your dates are Y2k-compliant and
unambiguous e.g. 02/03/07 is no use at all - which element is the year,
which the month and which the date?

Thirdly, 00/00/00 isn't even a valid date - using something else to
represent a blank or missing date e.g. null

&dateFrom=null&dateTo=29-Aug-2007
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 29 '07 #4
Thanks for this. I will remember this in future and ensure that I don't use /
in query strings again.

"Alexey Smirnov" wrote:
On Aug 29, 3:44 pm, Julia B <Jul...@discussions.microsoft.comwrote:
I've guessed that it's something to do with the fact that a post back is
processed through javascript and javascript may not recognise the /
character?? Like I said, total guesswork... so I've used some shared global

Would be good to the code where you do it

In general, / has to be passed as %2F and then decoded in the asp.net
code using HttpUtility.UrlDecode if necessary

Aug 29 '07 #5
Hi, thanks, I'll not use / again in query strings. At least I know for
certain that it's that.

I am aware of the dates issue, I process them and ensure that they are
correct when using them.

Julia

"Mark Rae [MVP]" wrote:
"Julia B" <Ju****@discussions.microsoft.comwrote in message
news:C9**********************************@microsof t.com...
This works fine, but I'm sure there's a more elegant solution? Perhaps, if
I'm right, there's a format I should be using for dates in query strings,
so
javascript can process it?

Yes, definitely!

Firstly, you're quite right about the forward slash character - try to avoid
that if you possibly can - hyphens are nomally good in URLs and
QueryStrings...

Secondly, you need to make sure that your dates are Y2k-compliant and
unambiguous e.g. 02/03/07 is no use at all - which element is the year,
which the month and which the date?

Thirdly, 00/00/00 isn't even a valid date - using something else to
represent a blank or missing date e.g. null

&dateFrom=null&dateTo=29-Aug-2007
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 29 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: B Briant | last post by:
I need to write an access query that will pull records from a table if the start or end dates input by the user are within the start and end dates in the db. I can't use BETWEEN because either of...
5
by: Bayla Frankl | last post by:
Hi all, I am a little stumped. I have a query I am trying to run to retrieve the last Progress Note record from the database for the current patient so that the therapists can see the last note...
1
by: ED | last post by:
I currently have an ODBC query that hits an Oracle database. I want to bring back records for a given month based on a job completion date in the Oracle database. I would like to have the user...
2
by: Giulio | last post by:
I make an import of a huge file txt table with headers at each page and date format as "20.12.2004" in order to use the data I first qo a query that exclude all line representing the headers...
6
by: CLarkou | last post by:
I have a field with dates in an Access database. The format of date is short date "19/06/2004". In my regional settings I have as date format "dd/mm/yyyy". When I create a query from design to...
5
by: m_t_hill | last post by:
Running MS Access 2000 MS Windows XP Pro This has caused me a lot of hair loss in the last few days so would appreciate any help. I am running code to append/update a local access database...
2
by: Keith | last post by:
Good Afternoon, New to .Net. I am trying to pass date/time values to a MS Access query depending on what value is selected from a dropdown list box (January, February, etc). I have declared...
3
by: seegoon | last post by:
Hi to all. I have a small problem I hope someone can help me with. I am running a sql query to a csv file. The query searches for the total of a column between 2 dates. This is a copy of one of...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.