aruni
aruni

Reputation: 2752

Extracting the full querystring from a URL

Using ASP.NET MVC, I have the following URL returned from a commeweb payment gateway:

http://localhost/ASP_VPC_3Party_DR?&vpc_AVSResultCode=Unsupported&vpc_AcqAVSRe
spCode=Unsupported&vpc_AcqCSCRespCode=Unsupported&vpc_AcqResponseCode=00&vpc_
Amount=100&vpc_AuthorizeId=000281&vpc_BatchNo=1&vpc_CSCRequestCode=N&vpc_CSCRe
sultCode=Unsupported&vpc_Card=AE&vpc_Command=pay&vpc_Locale=en_AU&vpc_MerchTxn
Ref=123&vpc_Merchant=TESTANDREWK&vpc_Message=Approved&vpc_OrderInfo=VPC+Exam
ple&vpc_ReceiptNo=030821000281&vpc_SecureHash=6EB600780CAA5B1C81BF3AF249E4B85
3&vpc_TransactionNo=281&vpc_TxnResponseCode=0&vpc_Version=1

I need to store this:

&vpc_AVSResultCode=Unsupported&vpc_AcqAVSRe
spCode=Unsupported&vpc_AcqCSCRespCode=Unsupported&vpc_AcqResponseCode=00&vpc_
Amount=100&vpc_AuthorizeId=000281&vpc_BatchNo=1&vpc_CSCRequestCode=N&vpc_CSCRe
sultCode=Unsupported&vpc_Card=AE&vpc_Command=pay&vpc_Locale=en_AU&vpc_MerchTxn
Ref=123&vpc_Merchant=TESTANDREWK&vpc_Message=Approved&vpc_OrderInfo=VPC+Exam
ple&vpc_ReceiptNo=030821000281&vpc_SecureHash=6EB600780CAA5B1C81BF3AF249E4B85
3&vpc_TransactionNo=281&vpc_TxnResponseCode=0&vpc_Version=1

... as a single variable in my database

Upvotes: 0

Views: 171

Answers (2)

kemals
kemals

Reputation: 226

You can get full url.

Request.Url.PathAndQuery

then parse string str.Substring(str.IndexOf('&'))

it gets whole string from starting of &

Upvotes: 0

nl-x
nl-x

Reputation: 11832

You ask about full url , but what you need is the query_string.

Full url: Request.Url.AbsoluteUri

Query string: Request.Url.Query

Upvotes: 3

Related Questions