"Object moved to here" error on running recorded test...
Brian Donahue
Posts: 6,590 Bronze 1
Hi Greg,
Not knowing how the web application works, it's hard to say. Presumably,
ErrorPage.aspx may have potentially provide some information as to what's
going wrong.
So I'd suggest this: Add a line to your script to get the error page and
log the content.
It should work like this:
WebClient.Get(login.aspx)
If HttpResponse.Status.Code=302 Then
WebClient.Get(HttpResponse.Headers("Location"))
Me.LogToFile(HttpResponse.Content)
That code will get the login page, and if it redirects you somewhere,
iit will go get the redirected page. Then you log the content of that page
to your log file.
ANTS Load doesn't handle 302 redirects like a browser really would; you
need to put conditions in your script to handle them if necessary.
Please let us know if you have any more questions.
Regards,
Brian Donahue
Red Gate Technical Support
"Greg Allen" <gallen@arrayinc.com> wrote in message
news:uBbQ4wadEHA.1508@server53...
> I have downloaded ANTS and am testing a web application. My simple
> test case is to simply log onto the system, do one thing, and then log
off.
>
> The test recorded fine, and the script looks OK. But when running the
> test things didn't look quite right (no database changes that I expected
to
> see from running the test occurred).
>
> After some investigation, I decided to look at the output from the POST.
> What I got back was this (via LogToFile(WebClient.HttpResponse.Content)):
>
> VirtualClient 4 7/29/2004 4:21:21 PM
> <html><head><title>Object moved</title></head><body>
> <h2>Object moved to <a href='/ErrorPage.aspx'>here</a>.</h2>
> </body></html>
>
> That is not what should be coming back.
>
> Any ideas? Is there some other debugging I could turn on to help
> me out?
>
> Thanks,
>
> -- Greg Allen
> gallen@arrayinc.com
>
>
Not knowing how the web application works, it's hard to say. Presumably,
ErrorPage.aspx may have potentially provide some information as to what's
going wrong.
So I'd suggest this: Add a line to your script to get the error page and
log the content.
It should work like this:
WebClient.Get(login.aspx)
If HttpResponse.Status.Code=302 Then
WebClient.Get(HttpResponse.Headers("Location"))
Me.LogToFile(HttpResponse.Content)
That code will get the login page, and if it redirects you somewhere,
iit will go get the redirected page. Then you log the content of that page
to your log file.
ANTS Load doesn't handle 302 redirects like a browser really would; you
need to put conditions in your script to handle them if necessary.
Please let us know if you have any more questions.
Regards,
Brian Donahue
Red Gate Technical Support
"Greg Allen" <gallen@arrayinc.com> wrote in message
news:uBbQ4wadEHA.1508@server53...
> I have downloaded ANTS and am testing a web application. My simple
> test case is to simply log onto the system, do one thing, and then log
off.
>
> The test recorded fine, and the script looks OK. But when running the
> test things didn't look quite right (no database changes that I expected
to
> see from running the test occurred).
>
> After some investigation, I decided to look at the output from the POST.
> What I got back was this (via LogToFile(WebClient.HttpResponse.Content)):
>
> VirtualClient 4 7/29/2004 4:21:21 PM
> <html><head><title>Object moved</title></head><body>
> <h2>Object moved to <a href='/ErrorPage.aspx'>here</a>.</h2>
> </body></html>
>
> That is not what should be coming back.
>
> Any ideas? Is there some other debugging I could turn on to help
> me out?
>
> Thanks,
>
> -- Greg Allen
> gallen@arrayinc.com
>
>
This discussion has been closed.
Comments
Okay, this could be down to a bug in the 1.60 (and earlier) version of
ANTS Load. What ANTS Load does is to look for Viewstate in the HttpResponse
content and assigning it to a variable called ViewState. Since Viewstate
pertains to ASP .net, it looks for pages with URLs that end in .aspx and
only captures the viewstate for those. Notice I said pages that END in
.aspx!
If you construct your own QueryString for the GET request, such as
http://localhost/MyPage.aspx?id=3, then ANTS Load will not parse the
viewstate and if you try to use the viewstate in your ANTS Load script, the
page will error because the ViewState will be Null.
As a temporary workaround, you can add the following function to your
ANTS Load script to go the viewstate gathering from the page:
Note: The argument to this function should be HttpResponse.Content and
the function will return the ViewState for that page.
Hopefully this will sort out your problem!
Private Function GetViewState(ByVal content As String) As String
Dim i As Integer
Dim vstate As String
vstate=""
i = content.IndexOf("__VIEWSTATE")
If i>0 Then 'We have found viewstate in the page
i=i+20 'skip __VIEWSTATE value=, etc
vstate = content.Substring(i)
vstate = vstate.Substring(1, vstate.IndexOf(Chr(34)) - 1) 'Get
the string up until the next quote
End If
GetViewState = vstate
End Function
"Greg Allen" <gallen@arrayinc.com> wrote in message
news:Qb1e7WYeEHA.2680@server53...
> That did give me more information. Here's the message on the error
> page:
>
> The View State is invalid for this page and might be corrupted.
>
> at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
> at System.Web.UI.Page.LoadPageViewState()
> at System.Web.UI.Page.ProcessRequestMain()
>
> From the documentation it appears that viewstate is supposed to be handled
> correctly. Is there something I need to do to turn it on?
>
> And here's my script for getting the login page:
>
> WebClient.HttpRequest.ProtocolVersion = "HTTP/1.1"
> BeginPage("http://site/virtualdir")
> WebClient.HttpRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE
> 6.0; Windows NT 5.0; T312461; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
> WebClient.Get("http://site/virtualdir")
> WebClient.Get("http://site/virtualdir/")
> WebClient.Get("http://site/virtualdir/include/Voyager.css")
>
> WebClient.Get("http://site/virtualdir/Client/Stuff/Styles/Voyager.css")
> WebClient.Get("http://site/virtualdir/include/Reports.css")
>
> WebClient.Get("http://site/virtualdir/Client/Stuff/Styles/Reports.css")
> WebClient.Get("http://site/virtualdir/include/VoyagerReports.css")
>
>
WebClient.Get("http://site/virtualdir/Client/Stuff/Styles/VoyagerReports.css
> ")
> WebClient.Get("http://site/virtualdir/include/spell.js")
> WebClient.Get("http://site/virtualdir/include/hashtable.js")
>
WebClient.Get("http://site/virtualdir/images/logos/logo_Stuff.png")
> WebClient.Get("http://site/virtualdir/images/voy_blue.jpg")
>
> WebClient.Get("http://site/virtualdir/images/splash_header_people.jpg")
> WebClient.Get("http://site/virtualdir/images/tab_left.gif")
> WebClient.Get("http://site/virtualdir/images/splash_top.jpg")
> WebClient.Get("http://site/virtualdir/images/tab_filler.gif")
> WebClient.Get("http://site/virtualdir/images/tab_right.gif")
> WebClient.Get("http://site/virtualdir/images/login.gif")
> WebClient.Get("http://site/virtualdir/images/RequestPassword.gif")
> WebClient.Get("http://site/virtualdir/images/splash_bot.jpg")
> EndPage("http://site/virtualdir")
> ' ' End of page 1 contains 20 request(s).
>
> Sleep(15111)
> BeginPage("http://site/virtualdir/Login.aspx")
> WebClient.HttpRequest.Pragma = "no-cache"
> WebClient.HttpRequest.ContentType =
> "application/x-www-form-urlencoded"
> WebClient.HttpRequest.AddPostData("__VIEWSTATE",
> WebClient.ViewState, False)
> WebClient.HttpRequest.AddPostData("_LoginCtl%3A_TBUserName",
> "stress1", False)
> WebClient.HttpRequest.AddPostData("_LoginCtl%3A_TBPassword", "",
> False)
> WebClient.HttpRequest.AddPostData("_LoginCtl%3A_BtnLogin.x", "59",
> False)
> WebClient.HttpRequest.AddPostData("_LoginCtl%3A_BtnLogin.y", "7",
> False)
> WebClient.POST("http://site/virtualdir/Login.aspx")
>
> logtofile("POSTED FROM LOGIN, CODE IS => " &
> webclient.HttpResponse.Status)
> 'logtofile(webclient.HttpResponse.Content)
> 'WebClient.Get("http://site/virtualdir/Login.aspx")
> If webclient.HttpResponse.Status = 302 Then
> WebClient.Get(webclient.HttpResponse.Headers("Location"))
> logtofile("MY LOCATION IS...." & vbNewLine &
> webclient.HttpResponse.Content & vbNewLine & "END OF LOCATION")
> 'Me.LogToFile(webclient.HttpResponse.Content)
> End If
>
> WebClient.HttpRequest.Pragma = Nothing
> WebClient.HttpRequest.ContentType = Nothing
> WebClient.Get("http://site/virtualdir/include/Voyager.css")
>
> WebClient.Get("http://site/virtualdir/Client/Stuff/Styles/Voyager.css")
> WebClient.Get("http://site/virtualdir/include/Reports.css")
>
> WebClient.Get("http://site/virtualdir/Client/Stuff/Styles/Reports.css")
> WebClient.Get("http://site/virtualdir/include/VoyagerReports.css")
>
>
WebClient.Get("http://site/virtualdir/Client/Stuff/Styles/VoyagerReports.css
> ")
> WebClient.Get("http://site/virtualdir/include/spell.js")
> WebClient.Get("http://site/virtualdir/include/hashtable.js")
>
WebClient.Get("http://site/virtualdir/images/logos/logo_Stuff.png")
>
> WebClient.Get("http://site/virtualdir/images/splash_header_people.jpg")
> WebClient.Get("http://site/virtualdir/images/voy_blue.jpg")
> WebClient.Get("http://site/virtualdir/images/tab_left.gif")
> WebClient.Get("http://site/virtualdir/images/tab_filler.gif")
> WebClient.Get("http://site/virtualdir/images/tab_right.gif")
> WebClient.Get("http://site/virtualdir/images/tv_space.gif")
> WebClient.Get("http://site/virtualdir/images/tv_plus.gif")
> EndPage("http://site/virtualdir/Login.aspx")
> ' End of page 2 contains 17 request(s).
>
> Any ideas what to try now?
>
> FYI, the application sets a session variable once a user is logged in. If
> that session variable does not exist, the assumption is a user is timed
> out and sent to the timeout page.
>
> It looks as if the logon never fully completes, as the record in the
> database
> is incomplete.
>
> -- Greg
>
>
>