I have a LINQ Statement to check if someone is entering the URL for a voucher Redemption. The way i get this voucher is by using a regular url, with an extra hashed CampaignID, Which is called my VoucherRedemption, as shown below.
if (Request.QueryString["voucherRedemption"] != null)
{
String VoucherRemption = Request.QueryString["voucherRedemption"];
MSCDatabaseDataContext MSCDB2 = new MSCDatabaseDataContext();
var getCampaign = from campaign in MSCDB2.Tbl_Campaigns
where campaign.Link.Contains(VoucherRemption)
select campaign;
var VoucherCampaign = getCampaign.FirstOrDefault();
campaignName.Value = VoucherCampaign.CampaignName;
campaignDescription.Value = VoucherCampaign.CampaignDescription;
txtStartDate.Text = VoucherCampaign.StartDate.ToString();
txtDateEnd.Text = VoucherCampaign.EndDate.ToString();
campaignAudience.Value = VoucherCampaign.Target.ToString();
txtDiscount.Text = VoucherCampaign.Discount.ToString();
txtTsCs.Text = VoucherCampaign.TermsConditions;
txtTsCs.ReadOnly = true;
CalendarExtender1.Enabled = false;
CalendarExtender2.Enabled = false;
txtStartDate.ReadOnly = true;
txtDateEnd.ReadOnly = true;
txtDiscount.ReadOnly = true;
txtEmail.Visible = true;
}
Now i keep getting a:
System.NullReferenceException: Object reference not set to an instance of an object.
But the weird thing is, is that yesterday it was working. But only yesterday. The other days it wasn't. Not its gone back to being broken. Is there somehow I can fix this?
Edit: I have checked that article, and still cant seem to find the problem. It was working yesterday