1.Assign an id to the body and add the runat="server" to it.
2.Add the following code to your code-behind (you can put it in the Page_Load event)
if (ConfigurationManager.ConnectionStrings["MyWebsite"].ConnectionString.Contains("test"))Modify the if statement to meet your needs.
body1.Style.Add("background-image", @"url(Images/test.jpg)");
else
body1.Style.Add("background-image", @"url(Images/production.jpg)");