views:

53

answers:

1

This is hurting my head. In a func i haave the code below. What is hurting my head is the fact i can se &id= in my RawUrl and it the value it should hold meanwhile req["id"] in the if statement returns null

    var req = HttpContext.Current.Request;
    string u = req.RawUrl; // --> /pstcm&id=5653999025705172077
    d = null;
    if (req["id"] != null)
+6  A: 

As far as I can see, the id=... is not specified as a querystring attribute. There's no ? before it. It's part of the URL path itself. The indexer of HttpRequest will only consider cookies, form values, querystring attributes, and server variables. Obviously, it cannot magically infer any arbitrarily defined format.

Mehrdad Afshari
acidzombie24
Mehrdad Afshari
acidzombie24