I have a querystring:
...default.aspx?date=May%202012
I want to get may and 2012 separately from that using:
Request.querystring("date")
....something similar for each.
Is this possible?
You can use HttpUtility.UrlDecode:
Dim dateParam = HttpUtility.UrlDecode(Request.QueryString("date"))
Dim dateParts = dateParam.Split(" "c)
Dim month = dateParts(0)
Dim year = dateParts(1)
C#
var dateParam = HttpUtility.UrlDecode(Request.QueryString["date"]);
var dateParts = dateParam.Split(' ');
var month = dateParts[0];
var year = dateParts[1];
Edit: As @Servy has commented HttpUtility.UrlDecode is redundant above since Request.QueryString decodes it implicitely, but it doesn't hurt ;-)
I want to get may and 2012 separatelyRequest.QueryString already does a UrlDecode, it shouldn't be decoded again.date parameter contains May 2012 (in decoded form). So you have to split it to get the May and 2012 separately.