|
I want to post information to many asp pages but it doesn't work correctly. To test, I created 2 pages: the first page is the "poster" and the second page is the "receiver"
The first page:
<script language=JavaScript>
function do_submit()
{
var i;
var count = 10;
for (i = 0; i < count; i++)
{
document.frmMain.Index.value = i;
document.frmMain.submit();
}
}
</script>
<form name=frmMain action="http://pcproject/multipost/destination.asp">
<input type=hidden name=Index>
<input type=button value=Test onclick="do_submit();">
</form>
The second page: Written in ASP, To monitor the result
Dim Index
Index = Request("Index")
Dim fs
Set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile Server.MapPath(Index)
Set fs = Nothing
'Do not return result
Response.Status = 204
I expected that after running the test, the second page would create 10 files named from 0 to 9 but sometimes the file names are from 1 to 9, sometimes from 2 to 9.
It seem that the first post and the second post take no effect.
The amazing thing is if I put the statement alert("something"); next to the statement document.frmMain.submit(); in the JavaScript code of the poster, the test is OK. May it need a delay time???
I'm so confuse, please help me.
|
|
|
|
|
I'm sure there's some sort of inherant design problem with what you're doing here. You should only need to post one form. Do all your processing on the server side. Why are you trying to post an arbvitrary number of times to the server? Why not just send that number to the server in a hidden field and get the server to do it?
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
Thanks for your soon reply.
The given example is only for illustrating my problem, it is not all I want to do. The story is:
My company has some offices in some countries which are connected to each other through leasedline.
I understand your idea, but in fact I'm developing an web application which is installed on several servers (each office has it own server). All that I want is when users login a website on a webserver, the login information will be dispatched to another websites on another webservers for handling user login session. So that, users do not need to login again when reaching to another websites because all of web applications are the same. The reason of installing the web applications on many servers is the leasedline is not reliable, frequently down. In addition, the essential task of the web application is to serve office-work and to share information with other offices.
I can send user login information to another website through my COM object at server side but not at client side. When sending from server side, the user session newly created in another webserver is not the same with the current user session (browser).
Please help me if you know my problem.
Thanks in advance.
|
|
|
|
|
I think your problem is that you have one form that you are trying to submit to multiple locations. This is not something you can do because it is essentially the same as trying to click five different links on the same page. Your page can only ever go to one place after you click a link, and it's the same with a form. Perhaps you could so something like dynamically constructing an iframe with form code and hidden fields inside it, submitting that form with javascript, and waiting for the process to be confirmed before you continue. It's a bit of a dodgy way to do it, but it might work. Alternatively, and this is the solution I'd be more inclined to try, do as I suggested earlier and submit your form to one ASP script, then in that script, create an XMLHTTP object and post details to the other pages on the other servers. This way you're not relying on your users' browsers to correctly submit forms, when they could well behave unexpectedly.
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
Thanks NATHAN.
I think it is not the same as trying to click multiple links.
As I know, the process is:
After each submission, the browser waits for the result processed from the server. But the second page (the processing page) return the status code 204 which indicates that no result will be sent back to the browser. So that the browser remains the original html content, nothing has changed, the next submission is a normal submission.
I've tried to use XMLHTTP but there are some constraints.
Firstly it bases on Microsoft component, secondly it cannot open more than one connection at a time, only one connection.
If you have any examples on this, please show me more.
|
|
|
|
|
why not create as many XMLHTTP components as you need?
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
Not simple as you thought. To test the XMLHTTP object I created 2 pages:
1. Destination page : destination.asp
This page is for testing the result, the result is file with numeric name increased one by one. i.e.: 0, 1, 2...
<CODE>
Response.Buffer = True
Dim Index
if Trim(Session("Index")) = "" then
Index = 0
Session("Index") = 0
else
Index = CLng(Session("Index"))
Index = Index + 1
Session("Index") = Index
end if
Dim fs
Set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile Server.MapPath(Index)
Set fs = Nothing
Response.Status = 204
</CODE>
2.The source page : source.asp
<CODE>
<html>
<head>
<script language=VBScript>
Function xmlhttp_test_single()
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", "http://pcproject/multipost/destination.asp", false
xmlhttp.send
Set xmlhttp = Nothing
End Function
<br>
<font color=000000>
Function xmlhttp_test_double()
xmlhttp_test_single
xmlhttp_test_single
end function
</font>
</script>
</head>
<body>
<form name=frmMain action="http://pcproject/multipost/destination.asp">
<input type=button value=Single onclick="xmlhttp_test_single()">
<input type=button value=Double onclick="xmlhttp_test_double()">
</form>
</body>
</html>
</CODE>
If I click the Single button, one file is created, if loop this step many times, many files are created, one file for one click.
But if I click the Double button, only one file is created.
The Double function looks like creating many XMLHTTP objects.
Could you please explain me why.
|
|
|
|
|
so if I understand this correctly, there are multiple web servers in multiple locations.
firstly, if you are hosting a server on an unreliable leased line circuit, and POSTING some semi-critical data to it, then what do you expect to happen IF you get your form posting to multiple locations BUT one of those locations is down? Seems to me that you app falls flat right there.
Why not go this route......
is there any one server that is not on a leasedline? IE, Fully reliable?
If so, when the form posts and you create your "session" file, create the file on the reliable server, say, as an XML file....
Then, reference this file from your "slave" servers when checking "session"..
These servers would check the "session" using something like this...
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "GET", "http://www.cdsgrants.com/Content/user.txt", false
objHttp.Send ""
if objHttp.status <> "200" then
Response.write "File Not Retrieved " & sResponse
Else
Response.Write objHTTP.ResponseTEXT & "
"
end if
set objHttp = nothing
|
|
|
|
|
your code should wait for the page to finish loading (after
document.frmMain.submit();<br />
while (document.frmMain.readyState != "complete")<br />
;
though you may have to put this check into a timer, otherwise you will yield no cpu time to the other window, and therefore the document will never finish loading...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Thanks Philip.
I've tried it but cannot, the readySate is always "complete"
The code look like that:
<br />
var sState = "";<br />
for(var i = 0; i<10; i++)<br />
{<br />
sState = sState + i + document.frmMain.readyState;<br />
frmMain.submit();<br />
sState += document.frmMain.readyState;<br />
}<br />
alert(sState);<br />
I can not resolve my problem till now.
|
|
|
|
|
but do not have a wait loop after the submit checking the state of the document!
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hi,
I don't know if this is the good board but anyway.
I've created a simple webService that I use in a Windows Application.
I can read data from my database, and I can add or update datas.
Is there a way to allow delete data from a webService. If yes can someone can help me to implement this.
Thx
Sybux
|
|
|
|
|
Your ability to add/edit/delete information from your database shouldn't have anything to do with your webservice. If you're having a problem with deleting, it's most likely a rights problem (as in the process you are running the web service in - likely the ASP.NET default account) needs to have the appropriate rights against your database.
Good Luck
David
|
|
|
|
|
Hi,
the problem is not in regards of rights...
The problem is how to implement a solution
Thx
Sybux
|
|
|
|
|
How can I put value into the ?
did not display the "image.jgp" in the textbox. How can I solve this?
thanks.
|
|
|
|
|
The standard says about file controls: "User agents may use the value of the value attribute as the initial file name." So the browser isn't required to do anything with the value attribute.
|
|
|
|
|
And generally they don't, because otherwise you could write a web page that uploads arbitrary files without the user's consent by simply including a hidden form that is auto submitted via javascript. This would be bad.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
I am working with an Access DB which is used to store customer and order information. Currently, this DB is entirely local, and the info is entered through forms in MS Access.
I am wanting to allow the option of extending the DB system to allow online transaction processing at a future date. I don't know a whole lot about the setup side of things in this area.
I could link to tables in the remote DB, but the tables would then be readonly, and I would not be able to edit them except via the web server. I suppose that only makes sense, because of what would happen if, for example, a record with a certain ID was added on the one copy, and then a record with that same ID was added on the other copy.
So what do I do here?
I've dealt with DBs on a web server, and ordinary Access and SQL databases, so I know how to work with those quite well. I also have head knowledge about client/server DBs on a LAN. But admittedly, I'm a bit of a newbie at remote/distributed database systems.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
IS there an HTML tag or some way of allowing me to vertically center text? I know you can use <center> to horizontally center, but what about vertically centering? Is it even possible?
If your nose runs and your feet smell, then you're built upside down.
|
|
|
|
|
Put the attribute:
valign="center"
in the enclosing tag (table/div/etc).
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Which website has the easiest to follow tutorial to making forums? I have searched google and what not, but I cant find one that is quite what I want. ---Thanks-- =)
1337 is probably the least Elite thing to say.
|
|
|
|
|
There was a time Chris had released the code for the CP forums which we use right now...and some dude ported it over to PHP too...which is always nice...cuz if yer like me....you prefer PHP
This is one option...
I'm drinking triples, seeing double and acting single
|
|
|
|
|
DO you just need a forum for your site, or are you trying to use it to learn more coding skills?
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
workin on my coding skills!
|
|
|
|
|
The code for the CodeProject forums is still available on this site. If you're interested in ASP.Net techniques, I believe I found a forum example at www.asp.net[^] as well.
"Some people are like Slinkies... not really good for anything, but you still can't help but smile when you see one tumble down the stairs."
|
|
|
|