|
Maybe check the referrer field?
|
|
|
|
|
The refferer field??
Is this in the URL?
|
|
|
|
|
I am no expert in this area... however I know our web page designer had similar problems.
I could make one suggestion which is if you can keep track of the previous page then if you return to that page there is a chance the back button was pressed - although the user could have navigated there via a link as well I guess...
Oh well as I said I am no expert...
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
Yes, thats the problem, I'm navigating round the site but need to know if I got there via a browser back button.
|
|
|
|
|
One way of ensuring that the form isn't handled more than once (an order form for example) is:
1. On the page that renders the form for the user to fill in: Set a session variable (named so that it doesn't conflict with other forms/pages) to 1.
2. On the page accepting the post (may be the same page, but method=POST): If the session variable isn't 1, reject the post (show an error message or do something completely different). Otherwise, if the form data is valid and processing succeeds, set the variable to 2. If not, display the form again (again setting the variable to 1), preferably amended with an error message.
This way you won't accept the same form twice. If you don't want to use session variables (if you're on a server farm, for example), use your database instead. For example, create a row with a unique key (Guid/uniqueidentifier is good, but if security is important, add a signature) when the form is first created and include the key (and the signature if you have one) in the form as a hidden field. You then track transaction progress with another field in the record.
This can be elaborated to cater for multi-step transactions as well (including call-backs from, say, credit card payment servers) - but this should give you the general principle. Remember that you should also handle the case when someone jumps right into the middle of your app - and that this may very well be a hacker, faking the entire form contents, the referer field and pretty much everything else (hence the signature idea).
And like another poster noted - welcome to the world of web development - statelessness sucks!
Peter the small turnip
(1) It Has To Work. --RFC 1925[^]
|
|
|
|
|
|
Not sure how that would help but thanks for the post.....
|
|
|
|
|
Hi,
I am using multiple threads in my application and want to abort or close all threads when Exit application or click on Disconnect.But in my case as shown in code, thread status remain alive even I m aborting.Can any1 give me code snippset that how to abort thread successfully :
<code> try
{
if (clog.clnt_th.IsAlive)
{
clog.clnt_th.Abort();
clog.clnt_th.Join(1);
}
if (ClPb.thvidinfo.IsAlive)
{
ClPb.thvidinfo.Abort();
ClPb.thvidinfo.Join(2);
}
if (ClPb.thvideofile.IsAlive)
{
ClPb.thvideofile.Abort();
ClPb.thvideofile.Join(3);
}
if (thvideo.IsAlive)
{
thvideo.Abort();
thvideo.Join(4);
}
}
catch(System.Threading.ThreadAbortException thexp)
{
MessageBox.Show("Time worker thread was aborted: " + DateTime.Now.ToString(),thexp.Message );
}
</code>
thvideo is parent thread and thvideofile and thvidinfo is its child threads.
Shanzay
|
|
|
|
|
You are aborting the thread, so it will throw a ThreadAbortException. Rather exit the thread properly.
|
|
|
|
|
Yes I'm aborting thread as I didnt find any other method for
closing thread.Plz Tell how to abort properly?
Shanzay
|
|
|
|
|
Just return from the ThreadStart method!
|
|
|
|
|
How to return and what to return plz tell clearly
Shanzay
|
|
|
|
|
Hy everyone!
I found the log4net tool which looks very interesting and powerful to me. I also found an article describing how to send log-messages to screen (An Introduction to the log4net logging library, using C#[^].
But the tons of codelines confuse me more than it helps I mean those of the log4net tool
So what I want to do is to write these log-messages described in there to a logfile instead of writing it to screen.
I guess this will be very simple for most of you but at the moment I am stuck. Could someone help me please how to change the code in this article so it writes the messages to a logfile?
Thanks!
Stephan.
|
|
|
|
|
logging to a file is already described in the article you link to. have a quick search for "FileAppender"..
|
|
|
|
|
ups sorry, yes you are right. looks like i didn't see it when quickly reading the article.
thanks for the hint!
|
|
|
|
|
Hi All,
I have a requirement to implement a common class for threading implementation for separate functionalities which support bulk data processing.Different pages(Main thread) need to call this class function, which need to create threads according to the number of data.Also after the threads executes it need to return some value to the calling page and bind it to the datagrid.
For eg:
Page A,B and C are may call the class ThreadImplementation.cs file. And in this class file i have function which will loop through the number of data that i got as input and split to sets of data and creates individual thread for each set. This thread will call the specific function in the same class for which Page A called the class. Say thread1 completes the execution, but how will show the same in the Datagrid in Page A, whose thread(Main) would have completed its execution by this time.
Specifically telling i can't make the Main thread to wait till the Worker threads are complete since the instantiation of the worker thread is done in the class file.
May i know i can implement this functionality some how.
Thanks and regards
KC
|
|
|
|
|
hi! I have this problem. I am trying to put a data from query in a XML document, the query sometime returns more then one row, and I want to display all of them in a XML document. With the current code, what I have I can return just one row,
Example I have two rows from the query:
PassengerID | Passenger Name | Passenger SSN |
1 John 2132
2 Jack 2323
With my current code, I am getting back the XML document just with the first row
<passengerid id="1">
<passengername>John
<passengerssn>2132
Any clue how I need to solve this?? I know that I need to use some for statement, but I don't know the proper way exactly. Thanks ahead
|
|
|
|
|
Without seeing your code we can't tell how it needs to be improved. If you are holding data in datatable then you can use WriteXml method to write its content to an xml file. If you don't know how to use for then I suggest you read basic book about c#
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
so this is the method what I am using for getting the data from DB and there I have a
private XmlDocument getTheData(string someString)
{
string query ="SELECT something FROM table WHERE something = '" + test + "'";
something=query;
string query3 = "SELECT something FROM table WHERE something= '" + test2 + "'";
something1=query3;
string query4 = "SELECT something FROM table WHERE something= '" + test2 + "'";
something2= query4
string query5 = "SELECT something FROM table WHERE something = '" + test2 + "'";
something3= query5;
return response.xmlDoc(something, something1, something2, something3);
}
Then I am returning the result from the queryes to the main method and I am getting the XML document, but just with one row of data, and when I am executing at SQL server studio
|
|
|
|
|
You can do a select that returns xml.
select .... from table1 for xml auto
There are various other options as well as auto, check them out in BOL, it could save yuo a heap of work.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I am working at C# and I am building a web service, so when I will input the data, the XML document returns just one row of data, not more then one.
|
|
|
|
|
In which case I am missing something. Your original question
laziale wrote: hi! I have this problem. I am trying to put a data from query in a XML document, the query sometime returns more then one row, and I want to display all of them in a XML document. With the current code, what I have I can return just one row,
says you want to return all the rows in an xml document, now you say
laziale wrote: the XML document returns just one row of data, not more then one.
So what exactly is the problem? If you can clarify maybe we can help
Bob
Ashfield Consultants Ltd
|
|
|
|
|
well..let's say I have in the result from the query more then one row of data. So with my current code I am succeeding to get just the first row of data. I guess, I need to work with for and arrays, but I am not so efficient in that, that's why I am looking for your help. How can I get for example the second, the third row, etc. from the query what I will execute. Thanks
|
|
|
|
|
It all depends on how you are reading the data I guess. If you want to do row by row processing with a datareader you can, but I would either use the ....for xml method and return all the rows as a single piece of xml, or as was suggested, put the data in a datatable (using a dataadaptor) then you can use WriteXml method.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Friends can any 1 tell me how can I keep the task bar visible ( I mean active as it normally remains under each window form) in my form?
|
|
|
|