I have to set these variables through with the QueryString array:
UtmSource = HttpContext.Current.Request.QueryString["utm_source"];
UtmMedium = HttpContext.Current.Request.QueryString["utm_medium"];
UtmCreative = HttpContext.Current.Request.QueryString["utm_creative"];
UtmCampaign = HttpContext.Current.Request.QueryString["utm_campaign"];
UtmTerm = HttpContext.Current.Request.QueryString["utm_term"];
UtmContent = HttpContext.Current.Request.QueryString["utm_content"];
Tag1 = HttpContext.Current.Request.QueryString["utm_source"];
Tag2 = HttpContext.Current.Request.QueryString["m"];
Some keys in the query string might throw null exception.
I don’t want to wrap each var in try catch and I don’t want to wrap all with try catch because if the first one fails, the entire will be null/avoided.
How can I safely access these variables?
what about using a method like this when you want to safely get a query string parameter’s value?