99
1010#if NETFULL
1111using System . Web ;
12- using System . Web . Routing ;
1312using StackifyLib . Web ;
1413
1514#endif
@@ -25,14 +24,20 @@ public class WebRequestDetail
2524 public static event SetWebRequestDetailEventHandler SetWebRequestDetail ;
2625
2726 private StackifyError _Error ;
27+
28+ public WebRequestDetail ( )
29+ {
30+
31+ }
32+
2833 public WebRequestDetail ( StackifyError error )
2934 {
3035 _Error = error ;
3136
3237#if NETFULL
3338 if ( System . Web . HttpContext . Current != null )
3439 {
35- Load ( System . Web . HttpContext . Current ) ;
40+ Load ( new HttpContextWrapper ( System . Web . HttpContext . Current ) ) ;
3641 }
3742#endif
3843
@@ -93,12 +98,12 @@ public WebRequestDetail(StackifyError error)
9398
9499
95100#if NETFULL
96- private void Load ( HttpContext context )
101+ public void Load ( HttpContextBase context )
97102 {
98103 if ( context == null || context . Request == null )
99104 return ;
100105
101- HttpRequest request = context . Request ;
106+ HttpRequestBase request = context . Request ;
102107
103108 try
104109 {
@@ -248,16 +253,16 @@ internal static void AddKey(string key, string value, Dictionary<string, string>
248253 }
249254
250255#if NETFULL
251- internal static Dictionary < string , string > ToKeyValues ( HttpCookieCollection collection , List < string > goodKeys , List < string > badKeys )
256+ internal static Dictionary < string , string > ToKeyValues ( HttpSessionStateBase collection , List < string > goodKeys , List < string > badKeys )
252257 {
253- var keys = collection . AllKeys ;
258+ var keys = collection . Keys ;
254259 var items = new Dictionary < string , string > ( ) ;
255260
256261 foreach ( string key in keys )
257262 {
258263 try
259264 {
260- HttpCookie cookie = collection [ key ] ;
265+ HttpCookie cookie = collection [ key ] as HttpCookie ;
261266
262267 if ( cookie != null && ! string . IsNullOrWhiteSpace ( cookie . Value ) && ! items . ContainsKey ( key ) )
263268 {
@@ -273,6 +278,32 @@ internal static Dictionary<string, string> ToKeyValues(HttpCookieCollection coll
273278 return items ;
274279 }
275280
281+ internal static Dictionary < string , string > ToKeyValues ( HttpCookieCollection collection , List < string > goodKeys , List < string > badKeys )
282+ {
283+ var keys = collection . Keys ;
284+ var items = new Dictionary < string , string > ( ) ;
285+
286+ foreach ( string key in keys )
287+ {
288+ try
289+ {
290+ HttpCookie cookie = collection [ key ] as HttpCookie ;
291+
292+ if ( cookie != null && ! string . IsNullOrWhiteSpace ( cookie . Value ) && ! items . ContainsKey ( key ) )
293+ {
294+ AddKey ( key , cookie . Value , items , goodKeys , badKeys ) ;
295+ }
296+ }
297+ catch
298+ {
299+ // ignored
300+ }
301+ }
302+
303+ return items ;
304+ }
305+
306+
276307 internal static Dictionary < string , string > ToKeyValues ( NameValueCollection collection , List < string > goodKeys , List < string > badKeys )
277308 {
278309 var keys = collection . AllKeys ;
0 commit comments