I am changing over to aspnet core razor from asp net web. It is a magazine that will be in the www root as they are JavaScript pages. How do I change a default aspx file to the razor format . I can't use system web Ui but I able to dowload system IO which has stream reader in it.
Below is the file any ideas or help would be great
sing System;
using System.IO;
using System.Web.UI;
namespace Bumples20.UI
{
public partial class IssuesDefault : BasePage
{
Thanks Jen
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;
}
//
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("Register")))
{
;
}
else
{
//String page = System.Web.HttpContext.Current.Request.Url.AbsoluteUri; // this.GetCurrentPageName();
this.Response.Redirect("~/Account/Login.aspx");
//throw new SecurityException("You are not allowed to edit existent articles!");
}
}
/* Execute */
this.LoadJavaScript();
/* Execute */
}
private void LoadJavaScript()
{
String javaScript = "";
javaScript += LoadFile("~/Issues/JavaScript/Page.js");
javaScript += LoadFile("~/Issues/JavaScript/Movime.js");
javaScript += LoadFile("~/Issues/JavaScript/TalkingBalloon.js");
javaScript += LoadFile("~/Issues/JavaScript/DivClass.js");
javaScript += LoadFile("~/Issues/JavaScript/MoveObjectsTo.js");
javaScript += LoadFile("~/Issues/JavaScript/MemoryClass.js");
javaScript += LoadFile("~/Issues/JavaScript/Magazine.js");
javaScript += LoadFile("~/Issues/JavaScript/TalkingBalloon.js");
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;
}
}
}