Empty viewstate after Get

Ian1971Ian1971 Posts: 44
edited April 11, 2005 12:58PM in ANTS Load
This used to be working, so now I am stumped.
I have simple script that does a WebClient.Get to get my page (which contains viewstate)
when I look at WebClient.ViewState after the GET call is made the ViewState is empty.
It is not empty after a POST, just a GET.
Its been a while since I last used Ants Load. Am I going mad and missing something?

I don't use SSL and I do follow the redirect that occurs after the GET.
If I save the contents of WebClient.HttpResponse.Content out to a file after the redirect I can definately see the viewstate in the html

Any ideas?

Ian

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Ian,

    Yes -- I can think of one possible sceanrio where ANTS Load would not capture the viewstate and put it into the WebClient.ViewState variable. If you've changed the extension name of your ASP .NET pages.

    It's possible to change the extension that ASP .NET uses in IIS. Sometimes administrators do this for security reasons (If I change the .aspx extension to .do, then hackers will not easily identify that I use ASP .NET). If that's the case, though, you'll also fool ANTS Load and it will not treat your requests as if they were ASP .net.

    Please let me know if you have or haven't changed the extension for ASP .net.
  • Thanks for the reply.
    Unfortunately I haven't changed the extension name of the ASP.NET web pages.
    Any other ideas?
  • What was happening was I was calling the page and get a redirect.
    I was then following the redirect and then getting no viewstate
    The redirect code was like this:
    If (WebClient.HttpResponse.Status = 302) Then

    WebClient.Get(WebClient.HttpResponse.Location)

    End If

    which worked however for some reason because the location was being returned as "/appname/page.aspx" rather than "http://localhost/appname/page.aspx"; ANTS could not find the viewstate. The page was being successfully returned though.
    Is this a bug?
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Ian,

    It could be. ANTS expects all GET requests to be a valid URI. If it's not the full URI and a relative path instead, then I could see ANTS throwing an exception even before it bothers to check that the address ends with .aspx.

    Does the redirect always send the user to the same page? You may want to simply use the full URI rather than the relative one that's being returned by the location header.
  • Yes. That is the work around I have put in place. I pre-pend the web root to the relative path returned if the path is not a full URI
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Ian,

    I'll keep that in mind for future reference, thanks.
This discussion has been closed.