Somedays back , I had to deploy a ASP.Net application in a secure environment for my client . But when I deployed my application in https environment , it started displaying a message " This page contains both secure and non-secure items. Do you want to continue ? " . Being a developer , this message is ok to me . But clients who are generic users might get scared of this . So I was asked to remove this error message . So How to remove " This page contains both secure and non secure items . " ?
- This message basically occurs when your application try to access a resource like image or some other file from a non secure server . So first you have to search for http in your code . Find all http links and replace them with https .
- Now check whether all your images and files are hosted on the same secure server where your application has been hosted . If not move them to secure environment .
protected override void Render(HtmlTextWriter writer)Add a new blank HTML page to your application folder and replace blank.htm in the above code with that page . Aslo replace Menu1 with your Menu Item Id . Once you make the changes , publish the code and check it in secure environment . The error message would not display again .
Page.ClientScript.RegisterStartupScript(typeof(Page), "MenuHttpsWorkaround", Menu1.ClientID + "_Data.iframeUrl='Blank.htm';", true);
For more ASP.NET Tips and tricks , subscribe to my blog or click here to get updates via email.