Answered by:
html files are not loading on default aspx or aspx.cs files

Question
-
User-605499000 posted
This site is for a magazine and the original program for each issue was pure javascript and the background pictures and story were fixed.
I am now trying to have a responsive site with the issues. I had to change the pages from jpg to html pages. I then tried to put the html pages on my default pages and can not. When I try to load the issues, it is not loading the html pages but trying to find jpg pages. Each issue has at least 30 pages with background pictures and also javascript games.
Below is the default aspx and default aspx css pages. They were the original ones that were written in 2009 when we first put the site up on the web.
I hope someone can help me get the html pages working. Thanks Jen
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Bumples.UI.Issues_Default" %>
<!doctype html >
<html><head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Bumples Magazine</title>
<link rel="stylesheet" href="../Css/MagazineStyles.css" type="text/css" />
<script src="/Issues/JavaScript/Movime.js"></script>
<script src="/Issues/JavaScript/DivClass.js"></script>
<script src="/Issues/JavaScript/TalkingBalloon.js"></script>
<script src="/Issues/JavaScript/Magazine.js"></script>
<script src="/Issues/JavaScript/PuzzleClass.js"></script>
<script src="/Issues/JavaScript/MemoryClass.js"></script>
<script src="/Issues/JavaScript/MoveObjectTo.js"></script><%= LoadCss() %>
</head><body onLoad="BmOnLoad();">
<form id="form1" runat="server">
<div>
</div>
</form>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10539155-1");
pageTracker._trackPageview();
} catch (err) { }
</script></body>
</html>using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;using System.IO;
using System.Security;using Bumples;
namespace Bumples.UI
{
public partial class Issues_Default : BasePage
{
private Int32 issue = 0;
private String section = "";protected void Page_Load(object sender, EventArgs e)
{
//
if (String.IsNullOrEmpty(this.Request.QueryString["Issue"]))
{
this.issue = 1;
//throw new SecurityException("Error loading Issue!");
}
else
{
try
{
this.issue = Int32.Parse(this.Request.QueryString["Issue"]);
}
catch
{
this.issue = 1;
}
}if (issue < 1 || issue > 25)
{
issue = 1;
//throw new SecurityException("Error loading Issue!");
}//
if (String.IsNullOrEmpty(this.Request.QueryString["Section"]))
this.section = "";
else
this.section = this.Request.QueryString["Section"];if (this.IssueName() == "Issue003" || this.IssueName() == "Issue004" || this.IssueName() == "Issue005" || this.IssueName() == "Issue006")
{
if (this.User.Identity.IsAuthenticated && (
this.User.IsInRole("Administrators") ||
this.User.IsInRole("Issue003") || this.User.IsInRole("Issue004") || this.User.IsInRole("Issue005") || this.User.IsInRole("Issue006") ||
this.User.IsInRole("Subscriber")))
{
;
}
else
{
//String page = System.Web.HttpContext.Current.Request.Url.AbsoluteUri; // this.GetCurrentPageName();
this.RequestLogin();
//Response.Redirect("~/Subscribe.aspx");
//throw new SecurityException("You are not allowed to edit existent articles!");
}
}/* Execute */
this.LoadJavaScript(); (Note is this where the problem is and the lines below that are loading the issue.)
/* Execute */}
private void LoadJavaScript()
{
String javaScript = "";
javaScript += LoadFile("~/Issues/" + this.IssueName() + "/JavaScript.js");Page.ClientScript.RegisterStartupScript(this.GetType(), "", javaScript, true);}
public String LoadCss()
{
return "<style type=\"text/css\"> " + LoadFile("~/Issues/" + this.IssueName() + "/CssStyles.css") + " </style>";
}private String IssueName()
{
return "Issue" + ((this.issue < 100) ? "0" : "") + ((this.issue < 10) ? "0" : "") + this.issue.ToString().Trim() + this.section;
}private String LoadFile(String fileName)
{
//Open a file for reading
fileName = Server.MapPath(fileName);//Get a StreamReader class that can be used to read the file
StreamReader objStreamReader = File.OpenText(fileName);//Now, read the entire file into a string
String fileContent = objStreamReader.ReadToEnd();objStreamReader.Close();
return fileContent;
}/*
protected void Page_Render(object sender, EventArgs e)
{
//
// Insert JavaScript for Image Upload Completed (Flash object will call this function when finished)
//
try
{
//LinkButton lb = (LinkButton)FormViewItem.Row.FindControl("LinkButtonProcessUpload");
//LinkButton lb = (LinkButton)RepeaterInfo.Items[0].FindControl("LinkButtonProcessUpload");
//HiddenField hf = (HiddenField)FormViewItem.Row.FindControl("FlashArguments");
//HiddenField hf = (HiddenField)RepeaterInfo.Items[0].FindControl("FlashArguments");String javaScript = "function UploadComplete() {";
//javaScript += String.Format("var hiddenFieldObj = document.getElementById('{0}');", hf.ClientID.Replace("_", "$"));
//javaScript += " if (hiddenFieldObj != null && _args != null)";
//javaScript += " {";
//javaScript += " hiddenFieldObj.value = _args;";
//javaScript += " alert(_args);";
//javaScript += " }";
//javaScript += " ";
javaScript += String.Format("__doPostBack('{0}', '' );", "var a=0;");
javaScript += "};";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "FileCompleteUpload", javaScript, true);
}
catch
{ }
}
*/
}
}Each issue folder contains a Image folder, pages fold, cssStyles and a javascript file. Below is one page with the html page and also the javascript file that opens the issue and has the games in it.
Folder Pages below
<!doctype html>
<html><head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Bumples Magazine</title>
<link rel="stylesheet" href="../Css/MagazineStyles.css" type="text/css" />
</head>
<body>
<div class="fullscreen"><div id="atlpg4" class="image"></div>
<div class="txt mag4-1">
<h1>Snail</h1>
<p><br />center; how are you. </p>
<p><br />center; good </p>
</div>
</div>
</body>
</html>javascript folder that opens up the pages etc and games which I don't have in it. Just the basic file.
///
// Issue Settings
//var issueNumber = 01;
var issuePageCount = 4;
var issuePageWidth = 800;
var issuePageHeight = 680;
var issueNextPage = 1;
// ==// Issue Name
// ==Issue_IssueName = function () {
return "Issue" + ((issueNumber < 100) ? "0" : "") + ((issueNumber < 10) ? "0" : "") + issueNumber.toString();
};
//====
// Load
//===function BmOnLoad() {
//====
// settings
//===bmPageWidth = issuePageWidth;
bmPageHeight = issuePageHeight;
bmNextPage = issueNextPage;var pageUriTemplate = Issue_IssueName() + "/Pages/pages-";
for (var pg = 1; pg <= issuePageCount; pg++)
bmPages[pg] = pageUriTemplate + ((pg < 10) ? "0" : "") + pg.toString() + ".jpg";BmInitialize();
//===
//===AddIndexToJumpTo(1, "Cover");
AddIndexToJumpTo(2, "Contents");
AddIndexToJumpTo(3, "Letter");
AddIndexToJumpTo(4, "Old Shail");//
// Page 2 - Contents
//InsertDinamicDiv(2, "", "", 70, 96, 452, 25, "BmFlipTo(1)", "", "", "");
InsertDinamicDiv(2, "", "", 70, 121, 452, 25, "BmFlipTo(2)", "", "", "");
InsertDinamicDiv(2, "", "", 70, 152, 452, 25, "BmFlipTo(4)", "", "", "");
//===========================================================================================
// Start
//===========================================================================================BmStart();
BmFlipTo(issueNextPage);
}Tuesday, January 29, 2019 2:45 AM
Answers
-
User-605499000 posted
Thank you very much for your help I tried and read everything that you suggested. They did not work or I couldn't get them to work. But I also realized that the problem is that Ihave to load the html in the javascrip file that loads the issue. That stream reader was reading the javascript and the css files. So now I am trying toload the html pages into the javascript file. I did add an div in aspx to go to html files.
Again thank you so much.,
Jen
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, January 31, 2019 12:35 AM
All replies
-
User-1174608757 posted
Hi bumples18,
When I try to load the issues, it is not loading the html pages but trying to find jpg pages.Could you please tell me how do you load the html pages in default aspx? Have you posted the code about this or is it in LoadJavaScript()?
If you want to load html in aspx, one way we often use HTMLContent control to save the html content ,another is that we could use Iframe and jquery.
I hope you could post the details about your load function code so we could find the problem. Else , you could follow the link as below to load html page in aspx. I hope it could help you.
https://forums.asp.net/t/1560540.aspx?Load+Html+Page+inside+aspx+page
https://stackoverflow.com/questions/4928132/loading-complete-html-page-in-contentpane-of-aspx-page
Best Regards
Wei Zhang
Wednesday, January 30, 2019 6:44 AM -
User-605499000 posted
Thank you very much for your help I tried and read everything that you suggested. They did not work or I couldn't get them to work. But I also realized that the problem is that Ihave to load the html in the javascrip file that loads the issue. That stream reader was reading the javascript and the css files. So now I am trying toload the html pages into the javascript file. I did add an div in aspx to go to html files.
Again thank you so much.,
Jen
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, January 31, 2019 12:35 AM