0

I usually don't deal with the old ASP pages of our websites. I have not changed any code in these pages. But all of the sudden, all the pages with a request("param") fail to load correctly.

This is basically how it is structured. All my pages have a few other .asp files included. On each of them I wrote something like response.write("test") at the end to make sure that the execution of the page was going through and it did. Then on my page I try to access, I tried at the very first line after all inclusions response.write("test") and this display the test message. Nevertheless, if I add just before that the statement request("param") BIM! no test message displayed.

I have no idea what it could be and even how I could debug it. Would you have any suggestions?

Again, I did not change any ASP code and it was working fine. The only thing I can think of is I added a new website on the server and I created a binding to that new website. But I did not add any binding to the previous website where ASP pages are. I don't know if it is related. This is also happening only on our test server. The production website is working fine.

EDIT: I noticed a server error saying The Template Persistent Cache initialization failed for Application Pool 'local.website1.com' because of the following error: Could not create a Disk Cache Sub-directory for the Application Pool. The data may have additional error codes. Could that be related?

EDIT: I just tried to change request("param") by Request.QueryString("param") and this worked but I don't want to edit every single page where I have request. How is this happening...

EDIT: another thing I tried. I emptied my page which now only has

<% 
  request("param")
  response.write("test")
%>

I access to that page from a link on a previous page. Going on my page with the link, I won't have the test message displayed. But if I go back in the url in the browser and hit enter (accessing the page directly, not like a link) it will display "test". Should I investigate the previous page instead? Is it something general linked to the parameter passing?

EDIT: one more thing done. On my page A pagea.aspx where I have my link to myasppage.asp?param=value, I created two links. One is a asp:linkbutton where I set postBackUrl = myasppage.asp?param=value; in the back. The other link is asp:hyperlink where I set navigateUrl = myasppage.asp?param=value;. The link from the hyperlink control works. The link from the linkButton does not work.

Greg
  • 640
  • 5
  • 11
  • 23
  • 1
    Have you actually enabled classic asp on the new website? It isn't enabled by default on IIS7 and above? – John Oct 02 '14 at 18:58
  • @John I meant that a new website has been made and added on the server. But here I am trying to access to asp page on the first website which was already here with functional asp pages – Greg Oct 02 '14 at 19:03
  • just to clarify classic asp is enabled and working property, you issue is that you want to use shorthand request("param") versus request.querystring("") or request.form("") ??? – Frank Oct 02 '14 at 19:08
  • @Frank The code has always used `request` and nothing else than that. That is the way it works on the prod server too. I believe classic ASP is enable since I can see sometimes things such as `<% response,write("test")`%> – Greg Oct 02 '14 at 19:11
  • so when you do a <%response.write("test")%> you see the words written test? If that is the case, please look at my answer below. The most likely thing I can think of is that you have competing querystring / form parameters and asp (since not being told which object to target) is targeting the default with values. Look at this SO answer for more clarificaiton: http://stackoverflow.com/questions/16588425/retrieving-parameters-from-request-asp-classic-3-0 – Frank Oct 02 '14 at 19:14
  • You know an easy test would be to list all querystring and all form variables just so you can see if anything is showing up. Here is an example http://stackoverflow.com/questions/9076577/looping-through-a-form-to-get-field-names-and-filed-values-issue-classic-asp – Frank Oct 02 '14 at 19:16
  • It will be something to do with how the ASP.Net LinkButton passes its callback, may be ViewState issue? Remember Classic ASP doesn't know about ViewState. – user692942 Oct 02 '14 at 21:24
  • 1
    Your question doesn't make it very clear you are trying to access `Request("param")` sent by an ASP.Net page. If you had been clearer on this point you might have saved a lot of peoples time. – user692942 Oct 02 '14 at 21:27
  • @Lankymart The question is in the title of the post and in the two first lines. The rest of it is more debug details to try to give more information for other people so that they can save time by not asking these things. I try to do `request("param")` and it does not work – Greg Oct 03 '14 at 13:34
  • @Greg You missed my point, do you know the difference between ASP.net and Classic ASP? Not once have you mentioned you are sending from an ASP.Net page (remember Classic ASP and ASP.Net are **not** the same not even close). – user692942 Oct 03 '14 at 13:52
  • @Lankymart I am aware of this. My issue occurs as long as the asp page tries to request a parameter. No matter if it is sent from an aspx page or asp page. My comments about the aspx page were in case it would be related. In my aspx page, 2 different controls redirecting to the same asp page with the same parameter in the url trigger two different results. It seemed odd enough to me to be mentioned. – Greg Oct 03 '14 at 14:24
  • @Greg In that case your just muddying the waters further. – user692942 Oct 03 '14 at 14:46
  • I asssume you can just use the HyperLink then? The reason for the difference is LinkButton causes the form to post while the HyperLink does not. With the LinkButton, what was the output of Frank's code to list all From and QueryString values? – lurker Oct 04 '14 at 18:12
  • @lurker With linkButton, the output of Frank's code was only one parameter pulled from the URL. So that shows that it is only when the page is posted that I have issues. Posted from aspx or asp. I could use hyperlinks here but other pages use posted form in asp and so this does not work. – Greg Oct 06 '14 at 13:32
  • Greg, how many pages are affected and are the affected pages all in one website? If in one site, is it the new site or the pre-existing site? – lurker Oct 06 '14 at 18:20
  • @lurker, All the asp pages with `request("param")` in their code are affected. It is the pre-existing site. – Greg Oct 06 '14 at 18:28

3 Answers3

1

The app pool for Classic ASP needs to run in Classic, rather than Integrated mode. Create a new app pool for the new web site if it is currently using the same app pool as the website1 site.

I jogged my memory by searching for "Request Form in Classic ASP stops working" or something similar.

I apologize for not thinking of this earlier. At least my previous answer was a good lesson in debugging. I hope you won't need to much Rograine to grow back the hair loss.

Greg
  • 640
  • 5
  • 11
  • 23
lurker
  • 159
  • 6
  • Is it real?? It seems working. But just a few question. The website has aspx and asp pages. Is it going to affect somehow the aspx pages? And any idea why this setting has changed so that asp pages were off? – Greg Oct 08 '14 at 13:14
  • Also on the prod server, the asp pages work perfectly and the application pool is set as integrated. Any reason for that? – Greg Oct 08 '14 at 13:25
  • Good question. The site I work on runs .Net 3.5 and Classic ASP using an app pool in Classic mode without issues. Here are some links with decent explanations of the differences http://stackoverflow.com/questions/716049/what-is-the-difference-between-classic-and-integrated-pipeline-mode-in-iis7 and http://www.hanselman.com/blog/MovingOldAppsFromIIS6ToIIS8AndWhyClassicModeExists.aspx – lurker Oct 08 '14 at 17:42
  • In response to the Prod server in Integrated Mode. Is the Classic ASP in a Virtual Directory or as a separate Application? Otherwise, is there a custom HttpHandler for the Classic ASP? – lurker Oct 08 '14 at 17:47
  • As far as I know, the box where the source code is is shared with other people/websites. So I would assume it is a virtual drive. For the httphandler, the web.config does not have any httphandler mentioning asp. Should I look somewhere else? – Greg Oct 08 '14 at 18:03
  • The website uses a third party component. When the application pool is set to asp classic, here is the server error I get `HTTP Error 500.21 - Internal Server Error Handler "thirdPartyComponent.Web.UI.ChartHttpHandler" has a bad module "ManagedPipelineHandler" in its module list` I believe this is not the right way to go anymore :( – Greg Oct 08 '14 at 18:24
  • Are all of the app pools on production set to Integrated Mode? – lurker Oct 09 '14 at 14:28
  • There is ASP.NET v4.0 (integrated). ASP.NET v4.0 Classic (Classic). Classic .NET AppPool (Classic). DefaultAppPool (Integrated). Website.com (integrated). On the test server, there is also ASP.NET v4.0 Classic (Classic). Classic .NET AppPool (Classic). – Greg Oct 09 '14 at 14:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/62765/discussion-between-lurker-and-greg). – lurker Oct 09 '14 at 15:20
  • Hi Lurker, I adding this comment to let you know that issue has been fixed. We use a third party component. In the Web.Config file, the compression module for the third party needed a little something... I am going to delete the question in a few days since this is very specific to my company. – Greg Nov 12 '14 at 19:21
  • Aha! I bet you have the 3rd party component documented now. Thanks for letting me know. – lurker Nov 12 '14 at 23:00
0

If the case is that you want to use the shorthand request("param") versus the long form request.querystring("param") or request.form("param") then you need to keep in mind that this shorthand method is not only sloppy in terms of coding but can also cause problems like you are having.

I am not sure in exactly what order things go in. But I think that request("param") will retrieve querystring params first, then forms, then cookies. (I may be wrong about that order). Where this because bad in terms of programming say you are using request("fname") instead of request.form("fname") to get data from a submitted form. But the url is form.asp?timestamp=234234. ASP is going to go after the querystring paramters and "fname" is going to be empty because it doesnt exist in the querystring. ASP is not smart enough to hunt for the parameter in all three (forms,querystring,cookies) objects.

Either clean up your code to request.form / request.querystring. Or investigate further to make sure the urls which are not working for you dont have hidden querystrings in them. A querystring might even show up if you have an IIS rewrite rule enabled which gives you pretty URLs.

Try this code to investigate what variables are working:

<%
      Response.Write ("<b>All form Variables</b><br>")
       For Each Item In Request.Form
        xName = Item
        xValue = Request.Form(Item)
        Response.Write("Name: " & xName & " | Value: " & xValue & "<BR>" )     
       Next 

       Response.Write ("<BR><b>All QuersyString Vars</b><br>")
       For Each Item In Request.Querystring
        xName = Item
        xValue = Request.Querystring(Item)
        Response.Write("Name: " & xName & " | Value: " & xValue & "<BR>" ) 
       Next 

 %>

If the above code ends up giving you both Form and Querystring variables (on the page in question) then you know you have an issue with ASP not knowing what object you are using.

Frank
  • 1,056
  • 3
  • 17
  • 38
  • Thanks for your answer Frank. In that case, why this code is still working on the prod server? Also I am using very simple code here. I start from an aspx page to end up in a asp page with one param in the url and two lines of code. `response.write(request("nUser")) response.write("greg
    ")` I don't see any hidden field in the page. How could I investigate further the hidden fields of urls?
    – Greg Oct 02 '14 at 19:19
  • Firstly, just create a file called test.asp. <% response.write("testing asp") %> if that works then you know its not an issue with configuring your local machine to run classic asp (clasic asp is not enabled by default). If that is working, then you likely have an issue where ASP does not know if you want to request form or request querystring because you have not told it which one. So ASP is guessing for you and is guessing wrong. The easiest way to investigage this would be to add a block of code to write out all the Request.Form and Request.Querystring params. – Frank Oct 02 '14 at 19:22
  • See my sample code on where you can list all form / querystring variables. – Frank Oct 02 '14 at 19:29
  • I tried the test.asp with a simple `<% response.write("testing asp") %>` which worked. I also tried the script loop to write all items in Request.Form but it seems that Request.From is stopping the execution of the page too. A simple `request.Form("param")` then `response.write("test")` works on my test page but does not work on the page I try to access from the aspx asp:linkbutton control... – Greg Oct 02 '14 at 19:33
  • can you enable detailed errors: http://blogs.msdn.com/b/rakkimk/archive/2007/05/25/iis7-how-to-enable-the-detailed-error-messages-for-the-website-while-browsed-from-for-the-client-browsers.aspx – Frank Oct 02 '14 at 19:37
  • Ok I tried that sample code Frank. Thanks for that. My test page displays: All form Variables. QuersyString Vars : nUser | Value: 27091. My actual page displays All form Variables. Does not go further IF I access to the page from the linkbutton control. It works if I access from the hyperlink control. – Greg Oct 02 '14 at 19:37
  • Also this so you can see Classic ASP errors - http://www.chestysoft.com/asp-error-messages.asp – Frank Oct 02 '14 at 19:38
  • Can you update your original question with both the page which is submitting the data, and the page which is handling the response? I am getting the impression that you are posting data from an ASP.net page to a classic asp page, and somehow asp.net is posting both form values and querystring values. The easiest way to to fix this is to actually update your code to use request.form and request.querystring. Its not only the easiest fix, its probably the right thing to do to prevent errors like this from happening in the future from query vars you did not expect to need to handle. – Frank Oct 02 '14 at 19:41
  • I believe I mention this in my 3rd EDIT when I completed my question. Should I specify more than that? Also, this is an example. But it is occurring from asp.net to asp classic or asp classic to asp classic. Even changing request for request.form on a few pages does not do it. It is like asp classic does not accept request or request.form anymore – Greg Oct 02 '14 at 19:46
  • I am not sure why request.form("param") would not be working. I have been coding classic asp since the late 90s and have never run into an issue where classic asp is running properly but the request.form object is not. The best test is to create two pages (both in classic asp) submitform.asp and requestform.asp and just submit a few form values and see if you can get them via asp. My bet is you are probably overlooking something, or have a typo in your parameter names. If its not working with a simple test, then something is wrong with your dev machine or iis. – Frank Oct 02 '14 at 19:51
  • I created two new pages with a quick form. Of course this worked. I would think something is wrong in the crashing page. But even emptying the page and writing basic code is making it crashing. So much for something no one touched for the last few months... Something must be occurring specific to my pages, not really asp classic anymore after the debugging you provided. Thanks Frank. – Greg Oct 02 '14 at 20:04
  • @Frank They are using an ASP.Net page to communicate via a POST to Classic ASP, the likelihood is they are passing something in their ASP.Net form that Classic ASP doesn't like. – user692942 Oct 02 '14 at 21:20
0

This is too much text for a comment, so I'll post it as a answer. I hope you don't mind doing one more test. Frank suggested enabling detailed errors (enable detailed errors in IIS). Please do this if you haven't already done so. Early in your question you stated the following code failed.

<% 
  request("param")
  response.write("test")
%>

Please add the folloiwng debugging lines to the test

<% 
  on error resume next 
  request("param")
  response.write "<br />Error number " & Err.number
  response.write "<br />Error description" & Err.Description
%>

Hopefully, this will give us some more detail about what the issue is. I suspect you're right about investigating the error you found. I found some posts about that issue which you may want to check out.

These two sites reference this site: Template Persistent Cache initialization failed for Application Pool" on IIS 7 using Classic ASP

Community
  • 1
  • 1
lurker
  • 159
  • 6
  • Thanks for this. I enabled detailed error and tried that script. My page stays blank... I tried `request("param");` just to see and it displayed `Microsoft VBScript compilation error '800a0401' Expected end of statement`. In the meantime I solved earlier that server error following the link you provided. But still. – Greg Oct 06 '14 at 20:50
  • We're making progress though! The compilation error is the semicolon. MY error is the first line. Please change it to `on error resume next` Also, please confirm IIS was restarted after fixing the server error. – lurker Oct 07 '14 at 13:34
  • My bad, I pasted the script wrong. Two instructions were on the same line. It is actually all blank the result of the page. No errors are raised. Losing my hair... – Greg Oct 07 '14 at 13:39
  • So, the response still stops on request param? Rats! Try commenting out the request line (comment's are apostrophes). The Error number should be a 0 without a description. BTW, losing hair is better than going gray. – lurker Oct 07 '14 at 14:03
  • One more thing to check. Is the application pool running in classic or integrated pipeline mode? – lurker Oct 07 '14 at 16:32
  • The application pool runs as integrated. Something new: I now get the error code -2147467259 when I run the script you gave me, without commenting the request line. If request line is commented, error number is 0 – Greg Oct 07 '14 at 18:23