I have an xml file, which is to be updated by an asp script (vbs) when users
are submitting forms from their browsers. Now I wonder if there is anything
that stops the following to occur:
1. User A submits form, resulting in asp script to create
MSXML2.DOMDocument.4.0, which loads the xml file and updates the in-memory
DOM tree
2. User B submits form, roughly at the same time, also resulting in asp
script to create MSXML2.DOMDocument.4.0, which loads the same xml file and
updates its own in-memory DOM tree
3. The thread handling user A saves its updated DOM tree back to disk,
replacing the original file
4. The thread handling user B saves its updated DOM tree back to disk,
replacing the file containing the updates just saved for user A
Is the above something that can happen, using IIS 5 and ASP script?
If so, would storing a FreeThreadedDOMDocument.4.0 in the Application
variable be a good way to fix this, or are there any better approaches?
Any help on this would be appreciated, since I am a little lost when it
comes to threading and asp.
Mats Olsson 9 2889
Mats Olsson wrote: I have an xml file, which is to be updated by an asp script (vbs) when users are submitting forms from their browsers. Now I wonder if there is anything that stops the following to occur:
1. User A submits form, resulting in asp script to create MSXML2.DOMDocument.4.0, which loads the xml file and updates the in-memory DOM tree 2. User B submits form, roughly at the same time, also resulting in asp script to create MSXML2.DOMDocument.4.0, which loads the same xml file and updates its own in-memory DOM tree 3. The thread handling user A saves its updated DOM tree back to disk, replacing the original file 4. The thread handling user B saves its updated DOM tree back to disk, replacing the file containing the updates just saved for user A
Is the above something that can happen, using IIS 5 and ASP script?
Of course If so, would storing a FreeThreadedDOMDocument.4.0 in the Application variable be a good way to fix this, or are there any better approaches?
Any help on this would be appreciated, since I am a little lost when it comes to threading and asp.
What are you trying to prevent? Shouldn't both users be allowed to save
their changes? Isn't user B allowed to overwrite changes made by user A?
It sounds like you need to use a database rather than XML or a file.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob,
thanks for your reply. What I am trying to prevent is user B effectively
clearing any additions/removals made by user A. In my scenario they both
start off with identical DOM trees (in different threads), due to the fact
that they happened to submit their forms at the same time. Now, suppose user
A added elements to the DOM tree before it was saved, then those elements
would get lost when the DOM tree from user B was saved to disk, since those
elements were not part of the user B's original DOM.
I could use a database, but I would prefer to be able to use the tree
structure of a DOM. That is why I thought that a shared in-memory DOM tree
(FreeThreaded), stored in the Application variable, would fix the problem
described above and below. Is there any reason why this approach would not
work?
Mats Olsson
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uY*************@tk2msftngp13.phx.gbl... Mats Olsson wrote: I have an xml file, which is to be updated by an asp script (vbs) when users are submitting forms from their browsers. Now I wonder if there is anything that stops the following to occur:
1. User A submits form, resulting in asp script to create MSXML2.DOMDocument.4.0, which loads the xml file and updates the in-memory DOM tree 2. User B submits form, roughly at the same time, also resulting in asp script to create MSXML2.DOMDocument.4.0, which loads the same xml file and updates its own in-memory DOM tree 3. The thread handling user A saves its updated DOM tree back to disk, replacing the original file 4. The thread handling user B saves its updated DOM tree back to disk, replacing the file containing the updates just saved for user A
Is the above something that can happen, using IIS 5 and ASP script?
Of course
If so, would storing a FreeThreadedDOMDocument.4.0 in the Application variable be a good way to fix this, or are there any better approaches?
Any help on this would be appreciated, since I am a little lost when it comes to threading and asp.
What are you trying to prevent? Shouldn't both users be allowed to save their changes? Isn't user B allowed to overwrite changes made by user A?
It sounds like you need to use a database rather than XML or a file.
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Mats Olsson wrote: Bob,
thanks for your reply. What I am trying to prevent is user B effectively clearing any additions/removals made by user A. In my scenario they both start off with identical DOM trees (in different threads), due to the fact that they happened to submit their forms at the same time. Now, suppose user A added elements to the DOM tree before it was saved, then those elements would get lost when the DOM tree from user B was saved to disk, since those elements were not part of the user B's original DOM.
I could use a database, but I would prefer to be able to use the tree structure of a DOM. That is why I thought that a shared in-memory DOM tree (FreeThreaded), stored in the Application variable, would fix the problem described above and below. Is there any reason why this approach would not work?
Yes. You could lock the application object while user A updated the DOM, but
when user B performs his updates, his DOM document will still contain the
pre-userA-update data and will overwrite the changes made by user A, given
that you are talking about replacing the entire application dom document
with the user's dom document.
You could add attributes to the dom document nodes to indicate which nodes
were changed and only update the relevant nodes in the application document,
but even this approach would not be perfect. However, it would be better
than simply overwriting the entire application dom document. The only
perfect approach would be to have a separate dom document for each user, but
this is apt to take up a significant amount of server memory.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob,
thanks again, but my idea was to have one DOM only, i.e. the FreeThreaded
one stored in the Application object. The asp script handling submitted
forms would then add elements to this DOM, as well as look up existing ones
in order to update them or remove them. The "worst" thing that could happen
(unless I have missed something) is that the thread handling user A just
removed an element which was the update "target" for user B. But that's ok.
And, of course, each asp script round would end with the DOM being saved to
disk.
Do you still feel that this would not work?
Mats Olsson
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> skrev i meddelandet
news:um**************@tk2msftngp13.phx.gbl... Mats Olsson wrote: Bob,
thanks for your reply. What I am trying to prevent is user B effectively clearing any additions/removals made by user A. In my scenario they both start off with identical DOM trees (in different threads), due to the fact that they happened to submit their forms at the same time. Now, suppose user A added elements to the DOM tree before it was saved, then those elements would get lost when the DOM tree from user B was saved to disk, since those elements were not part of the user B's original DOM.
I could use a database, but I would prefer to be able to use the tree structure of a DOM. That is why I thought that a shared in-memory DOM tree (FreeThreaded), stored in the Application variable, would fix the problem described above and below. Is there any reason why this approach would not work?
Yes. You could lock the application object while user A updated the DOM,
but when user B performs his updates, his DOM document will still contain the pre-userA-update data and will overwrite the changes made by user A, given that you are talking about replacing the entire application dom document with the user's dom document.
You could add attributes to the dom document nodes to indicate which nodes were changed and only update the relevant nodes in the application
document, but even this approach would not be perfect. However, it would be better than simply overwriting the entire application dom document. The only perfect approach would be to have a separate dom document for each user,
but this is apt to take up a significant amount of server memory.
Bob Barrows -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Oops, I actually meant the Application variable, not the Application object.
Mats
"Mats Olsson" <no****@nodomain.com> skrev i meddelandet
news:_1*********************@newsc.telia.net... Bob,
thanks again, but my idea was to have one DOM only, i.e. the FreeThreaded one stored in the Application object. The asp script handling submitted forms would then add elements to this DOM, as well as look up existing
ones in order to update them or remove them. The "worst" thing that could
happen (unless I have missed something) is that the thread handling user A just removed an element which was the update "target" for user B. But that's
ok. And, of course, each asp script round would end with the DOM being saved
to disk.
Do you still feel that this would not work?
Mats Olsson
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> skrev i meddelandet news:um**************@tk2msftngp13.phx.gbl... Mats Olsson wrote: Bob,
thanks for your reply. What I am trying to prevent is user B effectively clearing any additions/removals made by user A. In my scenario they both start off with identical DOM trees (in different threads), due to the fact that they happened to submit their forms at the same time. Now, suppose user A added elements to the DOM tree before it was saved, then those elements would get lost when the DOM tree from user B was saved to disk, since those elements were not part of the user B's original DOM.
I could use a database, but I would prefer to be able to use the tree structure of a DOM. That is why I thought that a shared in-memory DOM tree (FreeThreaded), stored in the Application variable, would fix the problem described above and below. Is there any reason why this approach would not work?
Yes. You could lock the application object while user A updated the DOM, but when user B performs his updates, his DOM document will still contain
the pre-userA-update data and will overwrite the changes made by user A,
given that you are talking about replacing the entire application dom document with the user's dom document.
You could add attributes to the dom document nodes to indicate which
nodes were changed and only update the relevant nodes in the application document, but even this approach would not be perfect. However, it would be better than simply overwriting the entire application dom document. The only perfect approach would be to have a separate dom document for each user, but this is apt to take up a significant amount of server memory.
Bob Barrows -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
The "Save to disk" part is where you will run into problems if I understand
what you mean by "each asp script round". When the DOM in Application is
saved to disk, it will completely overwrite the disk version.
You're really better off using a database when concurrency is an issue. I
can't stress that enough.
Mats Olsson wrote: Bob,
thanks again, but my idea was to have one DOM only, i.e. the FreeThreaded one stored in the Application object. The asp script handling submitted forms would then add elements to this DOM, as well as look up existing ones in order to update them or remove them. The "worst" thing that could happen (unless I have missed something) is that the thread handling user A just removed an element which was the update "target" for user B. But that's ok. And, of course, each asp script round would end with the DOM being saved to disk.
Do you still feel that this would not work?
Mats Olsson
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
I have the following function that is to import HTML data from a URL to
a MS-SQL table:
function gethtml(str)
'on error resume next
dim xmlhttp
set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", str, false
xmlhttp.send
newcontent = trim(xmlhttp.responseText)
if err.number <> 0 then
newcontent = "Error Retrieving URL, Please try again."
end if
set xmlhttp = nothing
' response.write ("<xmp>")
response.write (newcontent)
' response.write ("</xmp>")
end function
Works almost perfectly ... the URL's HTML is sucked in but the
whitespace is converted to ?'s.
Just1Coder wrote: I have the following function that is to import HTML data from a URL to a MS-SQL table:
function gethtml(str) 'on error resume next dim xmlhttp set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open "GET", str, false xmlhttp.send newcontent = trim(xmlhttp.responseText) if err.number <> 0 then newcontent = "Error Retrieving URL, Please try again." end if set xmlhttp = nothing ' response.write ("<xmp>") response.write (newcontent) ' response.write ("</xmp>") end function
Works almost perfectly ... the URL's HTML is sucked in but the whitespace is converted to ?'s.
You should have started your own thread instead of replying to this one.
Your problem is the lack of:
Response.ContentType = "text/xml"
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Thanks Bob.
Bob Barrows [MVP] wrote: Just1Coder wrote:
I have the following function that is to import HTML data from a URL to a MS-SQL table:
function gethtml(str) 'on error resume next dim xmlhttp set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open "GET", str, false xmlhttp.send newcontent = trim(xmlhttp.responseText) if err.number <> 0 then newcontent = "Error Retrieving URL, Please try again." end if set xmlhttp = nothing ' response.write ("<xmp>") response.write (newcontent) ' response.write ("</xmp>") end function
Works almost perfectly ... the URL's HTML is sucked in but the whitespace is converted to ?'s.
You should have started your own thread instead of replying to this one.
Your problem is the lack of: Response.ContentType = "text/xml"
Bob Barrows This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dan Kelley |
last post by:
We have a multithreaded app that responds to events, and writes these
events to a text file. This text file is used by an external system
for further processing.
We want to be able to write...
|
by: Nigel C |
last post by:
I have been tasked with converting a legacy Access 2 system to Access
2000. This in itself is not the issue.
I have a copy of the Program, Data and SYSTEM.MDA file used by the
client. However, I...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere
and VSS Remoting
This article makes a detailed...
|
by: Leonid |
last post by:
Hello
I have VC++ .NET 2003 ATL Server project. In one of its method I need to write some information in a local txt file. This txt file and this ATL Server are on the same ‘C: \’ drive. When...
|
by: daver |
last post by:
Hello all, I am running IIS 5.1 on Windows XP professional.
I am writing a web application in C# with Visual Studio.NET.
I would like to populate various data structures in my web application...
|
by: Steven Thomas |
last post by:
I have a windows service that uses office xp automation. Here is the
code
---------------------------------------
Public Sub CAccessSnapShot()
Try
Dim objAccess As New Access.Application()
Dim...
|
by: Mamatha |
last post by:
Hi
I have a small application in VB.NET,it consists of one
form,one class and one module.I have declared one thread
globally in module to execute the function in the form.I
started that thread...
|
by: dennist685 |
last post by:
Can't edit, delete or add row in an Access database in a website 2003
When I implement a walkthrough using Northwind I have no trouble doing this.
Also, in a windowsforms project I have no...
|
by: johnvon |
last post by:
Can it be done, and if so, how?
Thanks!
John
|
by: bazzer |
last post by:
hey,
im trying to access a microsoft access database from an ASP.NET web
application in visual basic 2003.NET. i get the following error when i
try running it:
Server Error in...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| | |