Error on opening ASP website - asp-classic

We changed the server of our ASP website and in new setting browsing the website returns this error:
msxml3.dll error '80072ee2'
The operation timed out
/error404.asp, line 41
This is lines that I think returns error:
Set XML=Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
XML.SetOption 2,13056
XML.SetTimeouts 90000, 90000, 90000, 90000
XML.Open "POST", website &"/catalog/page.asp?id="& R("CTLMtree_id") &"&rnd="& rnd(), False
XML.Send(Request.Form)
Response.Write XML.ResponseTExt
Set XML=Nothing

Are you sure that the website & &"/catalog/page.asp page exists ?
Are you sure that the Msxml2 dll has been registered.
Do you have other msxml?.dll's on the server? Try another version.
What happens if you increase the SetTimeouts values ?
Just a things thoughts that I would try.
But please format your code (indent each line with 4 spaces), so that we at least can see what the actual codes is.

Related

IIS returning a page in response.responseText

A user attempted to upload a file that was too large (70MB for a single PDF page) and the system errored out. This is correct and expected behavior, however in the response.responseText (in a jQuery AJAX call) instead of just being the message, it was raw text of an entire html page, cut off at a certain point, which I believe coincides with the default style of IIS error pages.
I do not want to increase the limit of the file size to allow the file to come through, but I do wish to make it to where response.responseText just returns the message (effectively, what's between the < title > < /title > tags).
I attempted to set breakpoints in the upload.ashx file to see if I could find where this was happening, but it never gets that far (if it is a normal file, these breakpoints hit). Which is fine, I'm okay with IIS gatekeeping (I imagine if I try to bypass IIS for handling it, the file is going to get uploaded to the server and then rejected. Plus, lose out on just letting IIS configuration handle this), but I don't want to return an entire page if possible.
To my mind, the resolution I see is to see if response.responseText contains DOCTYPE and if so, scrape what is inside the title tag, but I feel like there may be a more by the book way of doing this?
edit: I did see where someone recommended setting existingResponse="PassThrough" on the httpErrors section of web.config, but when I did this the responseText just became blank and it still didn't touch breakpoints so I don't think this is achieving what I'm after.
This probably isn't the best way to handle, but seems to work in this case so just running with it:
changed:
error: function (response) {
alert(response.responseText);
}
to:
error: function (response) {
var titleIndex = response.responseText.indexOf('<title>');
var titleEndIndex = response.responseText.indexOf('</title>');
var message = response.responseText.substr(titleIndex + 7, titleEndIndex - titleIndex - 7);
alert(message);
}
which returns "IIS 10.0 Detailed Error - 413.1 - Request Entity Too Large" in this particular instance.

Check if a webpage is online using VB in asp.net

I have been toying with getting this working for a while now to no avail.
I want to check if a website is available and display its status in a label. I have no code to share as I haven't got this anywhere close. I am using VS 2013 building a asp.net website using VB.
I thought I could just ping the website but after multiple test using command.exe the website doesn't respond to pings even when up.
I know the page will be taken offline periodically for updates as this happened last week and when it is you get page cannot be displayed. I need to test if the page is online and return true if it is and false if not.
The simple way is to do an httpWebRequest and examine the result. If the page doesn't exist, you will get an error that indicates that. I'm not as familiar with .webClient but that apparently works as well.
This past question gives you examples of both.
You can easily do this using HttpWebRequest.
try {
HttpWebRequest myHttpWebRequest = (HttpWebRequest) WebRequest.Create("siteAddress");
HttpWebResponse myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse();
myHttpWebResponse.Close();
}
catch(WebException e) {
//There is a problem accessing the site
}

Moved from Windows server 2000 to 2008 now classic ASP catalog queries not working correctly

This one is driving me crazy.
Replaced our old Windows 2000 web server with a Windows 2008 one which means moving to IIS7.
Now the move went smoothly except for the search catalogs we had set up on the old machine.
I added the Indexing Service and created the catalog for our website.
However, now the classic ASP page that queries the catalog is behaving strangely.
Specifically, the "vpath" and "doctitle" are blank. Other fields are being returned correctly like "characterization" and "rank" but others are not.
And the most annoying part is anytime I make a change to the search results page I get this error:
The page cannot be displayed because an internal server error has occurred.
...and I have to wait a couple of seconds before retrying. And then the page will come up fine. Very bizarre.
Anyway, here's the classic ASP code:
Set objQuery = Server.CreateObject("ixsso.Query")
With objQuery
.Catalog = "Website"
.Columns = "doctitle, vpath, size, characterization, rank"
.SortBy = "rank[d], doctitle"
.MaxRecords = 50
End With
objQuery.Query = "(#filename *.asp) AND (#contents " & Request.Form("searchterms") & ")"
Set rsSystem = objQuery.CreateRecordset("nonsequential")
Do Until rsSystem.EOF
%><dt><% = rsSystem("doctitle") %></dt>
<dd><% = rsSystem("characterization") %>...</dd><%
rsSystem.MoveNext
Loop
Anyone else experience this?
Thanks.
The first thing you should do is to Enable IIS's detailed errors, to indicate which line of code is causing this error specifically.
Read the following page's "2) Enable IIS7 detailed errors" section, and give it a try. I hope it will help you some.
http://mvolo.com/blogs/serverside/archive/2007/07/26/Troubleshoot-IIS7-errors-like-a-pro.aspx

Response Buffer Limit Exceeded

I am running a simple query to get data out of my database & display them. I'm getting an error that says Response Buffer Limit Exceeded.
Error is : Response object error 'ASP 0251 : 80004005'
Response Buffer Limit Exceeded
/abc/test_maintenanceDetail.asp, line 0
Execution of the ASP page caused the Response Buffer to exceed its configured limit.
I have also tried Response.flush in my loop and also use response.buffer = false in my top of the page, but still I am not getting any data.
My database contains 5600 records for that, Please give me some steps or code to solve the issue.
I know this is way late, but for anyone else who encounters this problem: If you are using a loop of some kind (in my case, a Do-While) to display the data, make sure that you are moving to the next record (in my case, a rs.MoveNext).
Here is what a Microsoft support page says about this:
https://support.microsoft.com/en-us/help/944886/error-message-when-you-use-the-response-binarywrite-method-in-iis-6-an.
But it’s easier in the GUI:
In Internet Information Services (IIS) Manager, click on ASP.
Change Behavior > Limits Properties > Response Buffering Limit from 4 MB to 64 MB.
Apply and restart.
The reason this is happening is because buffering is turned on by default, and IIS 6 cannot handle the large response.
In Classic ASP, at the top of your page, after <%#Language="VBScript"%> add:
<%Response.Buffer = False%>
In ASP.NET, you would add Buffer="False" to your Page directive.
For example:
<%#Page Language="C#" Buffer="False"%>
I faced the same kind of issue, my IIS version is 8.5. Increased the Response Buffering Limit under the ASP -> Limit Properties solved the issue.
In IIS 8.5, select your project, you can see the options in the right hand side. In that under the IIS, you can see the ASP option.
In the option window increase the Response Buffering Limit to 40194304 (approximately 40 MB) .
Navigate away from the option, in the right hand side top you can see the Actions menu, Select Apply. It solved my problem.
If you are not allowed to change the buffer limit at the server level, you will need to use the <%Response.Buffer = False%> method.
HOWEVER, if you are still getting this error and have a large table on the page, the culprit may be table itself. By design, some versions of Internet Explorer will buffer the entire content between before it is rendered to the page. So even if you are telling the page to not buffer the content, the table element may be buffered and causing this error.
Some alternate solutions may be to paginate the table results, but if you must display the entire table and it has thousands of rows, throw this line of code in the middle of the table generation loop: <% Response.Flush %>. For speed considerations, you may also want to consider adding a basic counter so that the flush only happens every 25 or 100 lines or so.
Drawbacks of not buffering the output:
slowdown of overall page load
tables and columns will adjust their widths as content is populated (table appears to wiggle)
Users will be able to click on links and interact with the page before it is fully loaded. So if you have some javascript at the bottom of the page, you may want to move it to the top to ensure it is loaded before some of your faster moving users click on things.
See this KB article for more information http://support.microsoft.com/kb/925764
Hope that helps.
Thank you so much!
<%Response.Buffer = False%> worked like a charm!
My asp/HTML table that was returning a blank page at about 2700 records. The following debugging lines helped expose the buffering problem: I replace the Do While loop as follows and played with my limit numbers to see what was happening:
Replace
Do While not rs.EOF
'etc .... your block of code that writes the table rows
rs.moveNext
Loop
with
Do While reccount < 2500
if rs.EOF then recount = 2501
'etc .... your block of code that writes the table rows
rs.moveNext
Loop
response.write "recount = " & recount
raise or lower the 2500 and 2501 to see if it is a buffer problem. for my record set, I could see that the blank page return, blank table, was happening at about 2700 records, good luck to all and thank you again for solving this problem! Such a simple great solution!
You can increase the limit as follows:
Stop IIS.
Locate the file %WinDir%\System32\Inetsrv\Metabase.xml
Modify the AspBufferingLimit value. The default value is 4194304, which is about 4 MB.
Changing it to 20MB (20971520).
Restart IIS.
One other answer to the same error message (this just fixed my problem) is that the System drive was low on disk space. Meaning about 700kb free. Deleting a lot of unused stuff on this really old server and then restarting IIS and the website (probably only IIS was necessary) cause the problem to disappear for me.
I'm sure the other answers are more useful for most people, but for a quick fix, just make sure that the System drive has some free space.
I rectified the error 'ASP 0251 : 80004005' Response Buffer Limit as follow:
To increase the buffering limit in IIS 6, follow these steps:
Click Start, click Run, type cmd, and then click OK.
Type the following command, and then press ENTER:
cd /d %systemdrive%\inetpub\adminscripts
Type the following command, and then press ENTER:
cscript.exe adsutil.vbs SET w3svc/aspbufferinglimit LimitSize
Note LimitSize represents the buffering limit size in bytes. For example, the number 67108864 sets the buffering limit size to 64 MB.
To confirm that the buffer limit is set correctly, follow these steps:
Click Start, click Run, type cmd, and then click OK.
Type the following command, and then press ENTER:
cd /d %systemdrive%\inetpub\adminscripts
Type the following command, and then press ENTER:
cscript.exe adsutil.vbs GET w3svc/aspbufferinglimit
refers to https://support.microsoft.com/en-us/kb/944886
If you are looking for the reason and don't want to fight the system settings, these are two major situations I faced:
You may have an infinite loop without next or recordest.movenext
Your text data is very large but you think it is not! The common reason for this situation is to copy-paste an Image from Microsoft word directly into the editor and so the server translates the image to data objects and saves it in your text field. This can easily occupies the database resources and causes buffer problem when you call the data again.
In my case i just have writing this line before rs.Open .....
Response.flush
rs.Open query, conn
It can be due to CursorTypeEnum also. My scenario was the initial value equal to CursorTypeEnum.adOpenStatic 3.
After changed to default, CursorTypeEnum.adOpenForwardOnly 0, it backs to normal.

ASP.NET Unexpected and Different Behavior in Different Environments

I have an ASP.NET site (VB.NET) that I'm trying to clean up. When it was originally created it was written with no error handling, and I'm trying to add it in to improve the User Experience.
Try
If Not String.IsNullOrEmpty(strMfgName) And Not String.IsNullOrEmpty(strSortType) Then
If Integer.TryParse(Request.QueryString("CategoryID"), i) And String.IsNullOrEmpty(Request.QueryString("CategoryID"))
MyDataGrid.DataSource = ProductCategoryDB.GetMfgItems(strMfgName, strSortType, i)
Else
MyDataGrid.DataSource = ProductCategoryDB.GetMfgItems(strMfgName, strSortType)
End If
MyDataGrid.DataBind()
If CType(MyDataGrid.DataSource, DataSet).Tables("Data").Rows.Count > 0 Then
lblCatName.Text = CType(MyDataGrid.DataSource, DataSet).Tables("Data").Rows(0).Item("mfgName")
End If
If MyDataGrid.Items.Count < 2 Then
cboSortTypes.Visible = False
table_search.Visible = False
End If
If MyDataGrid.PageCount < 2 Then
MyDataGrid.PagerStyle.Visible = False
End If
Else
lblCatName.Text &= "<br /><span style=""fontf-size: 12px;"">There are no items for this manufacturer</span>"
MyDataGrid.Visible = False
table_search.Visible = False
End If
Catch
lblCatName.Text &= "<br /><span style=""font-size: 12px;"">There are no items for this manufacturer</span>"
MyDataGrid.Visible = False
table_search.Visible = False
End Try
Now, this is trying to avoid generating a 500 error by catching exceptions. There can be three items on the query string, but only two matter here. In my test environment and in Visual Studio when I run this site, it doesn't matter if that item is on the query string. In production, it does matter. If that third item isn't present (SubCategoryID) on the query string, then the "There are no items for this manufacturer" displays instead of the data from the database.
In the two different environments I am seeing two different code execution paths, despite the same URLs and the same code base.
The site is running on Server 2003 with IIS 6.
Thoughts?
EDIT:
In response to the answer below, I doubt it's a connection error (though I see what you're getting to), as when I add the SubCategoryID to the query string, the site works correctly (displaying data from the database).
Also, if please let me know if you have any suggestions for how to test this scenario, without deploying the code back to production (it's been rolled back).
I think you should try to print out the exception details in your catch block to see what the problem is. It could anything for example a connection error to your database.
The error could be anything, and you should definitely consider printing this out or logging it somewhere, rather than making the assumption that there's no data. You're also outputting the same error message to the UI for two different code paths, which makes things harder to debug, especially without knowing if an exception occurred, and if so, what it was.
Generally, it's also better not to have a catch for all exceptions in cases like this, especially without logging the error. Instead, you should catch specific exceptions and handle these appropriately, and any real exceptions can get passed up the stack, ideally to a global error handler which can log it and/or send out some kind of error notification.
I discovered the reason yesterday. In short it was because when I copied my files from my computer into my dev-test environment, I missed a file, which ironically caused it to work, rather than not. So in the end it would have functioned the same in both environments.

Resources