ravi sharma

ravi sharma

  • NA
  • 87
  • 15.4k

Issue when replacing string from html template to hyperlink

Jan 10 2017 4:11 AM
Hi All,
 
 
I have done some code which used html file as template and replace ##BG## from html template to url of image. Everything is working file on stage, but when I deployed on production, it is not showing any background images on production. Please suggest. Below is the code.
 
StreamReader stringHtml = System.IO.File.OpenText(System.Web.Hosting.HostingEnvironment.MapPath("~/assets/dictionary/lrn-cpets-certificate.html"));
string changeHtml = stringHtml.ReadToEnd();
if (certificateCount >= 1 && certificateCount <= 2)
{

changeHtml = changeHtml.Replace("##BG##", EnvironmentFrontEndUrl + "/assets/images/cpet/standard.jpg");
}
else if (certificateCount >= 3 && certificateCount <= 5)
{
changeHtml = changeHtml.Replace("##BG##", EnvironmentFrontEndUrl + "/assets/images/cpet/bronze.jpg");
}
else if (certificateCount >= 6 && certificateCount <= 9)
{
changeHtml = changeHtml.Replace("##BG##", EnvironmentFrontEndUrl + "/assets/images/cpet/silver.jpg");
}
else if (certificateCount == 10)
{
changeHtml = changeHtml.Replace("##BG##", EnvironmentFrontEndUrl + "/assets/images/cpet/gold.jpg");
}
changeHtml = changeHtml.Replace("##DictionaryListing##", Name.ToUpper());
changeHtml = changeHtml.Replace("##DictionaryListing2##", HttpUtility.UrlDecode(objCPETSCertificate[i].CourseName.ToUpper()));
if (objCPETSCertificate[i].CompletionDate != null)
{
DateTime dt = objCPETSCertificate[i].CompletionDate;
string strDate = String.Format("{0:d MMM yyyy}", dt);
changeHtml = changeHtml.Replace("##DictionaryListing3##", Convert.ToString(strDate));
}
else
{
changeHtml = changeHtml.Replace("##DictionaryListing3##", string.Empty);
}
 
Following is the code of html file which I am using as a template.
 
<style type="text/css">
.wrapper {
/*width: 1250px;
height: 870px;*/
width: 1250px;
height: 880px;
font-family: 'OpenSansRegular';
color: #092f57;
background-image: url(##BG##);
background-size: 100% 100%;
background-repeat: no-repeat;
}
</style>
 

Answers (1)