ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   ASP.NET and parameters in URL (request.querystring) (https://www.scoobynet.com/computer-and-technology-related-34/312733-asp-net-and-parameters-in-url-request-querystring.html)

Fatman 22 March 2004 09:50 PM

ASP.NET and parameters in URL (request.querystring)
 
Hi folks,

Is there some sort of data type restriction on what can be passed in the URL? e.g. I have a page that takes data thus... page.aspx?something=123&somethingelse=456&somethin gnew=A

...except every time the parameter 'somethingnew' is passed, it generates a server error. I can pass other parameters (with numical values) fine, but whenever I try to pass this thing with an alphabetical value it fails. Why? Is the request.querystring method only capable of retrieving numerical data?

Or, does this suggest I've done something silly elsewhere in that page of code?

judgejules 23 March 2004 12:19 AM

Its not something simple like a reserved html symbol in the url parameter ?

I had a problem years ago where I was passing &section=1 into a page and it was erroring as &sect is a special symbol

A URL has a certain lenght if that helps... could you post the error message up, or PM me the code/error ?

Jules

Fatman 23 March 2004 10:15 AM

It's plausible, I suppose the offending parameter is &status=Y.

judgejules 23 March 2004 12:07 PM

Hmm, tried that here and it doesnt seem to throw a prob. Error might lie elsewhere. Post a screeny a blank out any info you dont want to make public if you want and I'll see what I can spot.

J

Fatman 23 March 2004 12:16 PM

Thanks for the offer JJ. A screen shot of what? The source code of the receiving page?

judgejules 23 March 2004 12:18 PM

yup and the error pwease :)

stevencotton 23 March 2004 12:25 PM

Having entities in the query string has no relation to the problem (or shouldn't have, unless some implementation is severely broken); any extended characters should be URL-encoded in the query string. HTML entities have no bearing because a URL doesn't contain any HTML (although IE 4.01 had a crappy bug which would entity-ise certain query string combinations, shown in access logs).

Steve.

Fatman 23 March 2004 01:20 PM

The payment provider I'm using is WorldPay. If a callback fails they are able to send a notification email. That's what tells me the callback string they attempted to use. Here's an extract of one such email...

WorldPay callback failure message...

Our systems have detected that your callback has failed.
This callback failure means we were unable to pass information
to your server about the following transaction:
Transaction ID: (transaction ID removed)
Cart ID: (cart ID data removed)
Installation ID: (installation ID removed)
Error reported: Callback to http://www.url.com/page.aspx?status=Y&transaction=(numerical data removed)&MC_UserID=(numerical data removed): NOT OK, recevied HTTP status: 500
Here's an edit copy of the sub which is being called.


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim userIDstring As String
Dim transaction As String
Dim WPtransStatus As String
'(other definitions removed)

transaction = Request.QueryString("transaction")
Label1.Text = transaction
userIDstring = Request.QueryString("MC_UserID")
Label2.Text = userIDstring
WPtransStatus = Request.QueryString("status")
Label3.Text = WPtransStatus

If WPtransStatus = "Y" Then 'Yes, WP transaction authorised
Label4.Text = "Status = Y"
'(code removed)
If (condition removed) Then
'(code removed)
Else
If (condition removed) Then
'do stuff
End If
End If
End If 'end If WPtransStatus = "Y"
If WPtransStatus = "C" Then 'No, WP transaction cancelled
Label4.Text = "Status = C"
'do stuff
End If 'end If WPtransStatus = "C"
End Sub
I know there's a lot removed, but it's all irrelevant stuff. You'll notice that I've used ASP label controls to 'debug' the values in the variables transaction, userIDstring and WPtransStatus. I've also used another label to 'debug' whether two other conditional loops are being executed.

If I run the page without the 'status' parameter (but with the other two) then the page runs ok. The two labels are populated correctly with their respective values. The other two (the status one and the conditional loop one) are blank.

Hopefully I've just done something silly with the 'status' parameter. Something which I've missed even after typing/editing this post...? Thanks for the help guys.

judgejules 23 March 2004 02:49 PM

Looks ok. If you call the page by hand with the status parameter what error does it give. Could you paste that in here?

Fatman 23 March 2004 03:45 PM

I was afraid you might say that. I was hoping there was some error that was blindingly obvious to someone else, yet that I couldn't see. :(

Error messages are switched off on the server for security reasons. I presume that it would generate the same error as WorldPay reported, HTTP 500.

What next?

judgejules 23 March 2004 05:29 PM

Set it up on a dev environment to see where its going wrong when you call it, or if the site is live, enable debugging for a few minutes in the early morning so you can see?

I'm guessing you dont have "Show friendly HTTP error messages" turned on in IE when you browse the broken page?

Jules

Fatman 23 March 2004 06:10 PM

Yes, the site is live. The webserver is configured to show the following message whenever an error is thrown.


Server Error in '/' Application.
--------------------------------------------------------------------------------
Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

I reckon your idea of enabling 'real' error messages temporarily will be a good solution. Shame it will have to be done at some silly time of the day when (hopefully) nobody will be using the site!

umesh09 03 September 2011 12:31 PM

use try catch to fetch error
 
use try catch and send mail in catch to you. with exception message.


All times are GMT +1. The time now is 09:46 AM.


© 2024 MH Sub I, LLC dba Internet Brands