Writing html code dynamically to an aspx file - sql-server

I have HTML stored in a Microsoft SQL Server column, and I also have an blank .aspx file called myreport.aspx. My problem now is, when I retrieve the contents of the column from the database, I want to be able to write it to the empty myreport.aspx file and use Response.Redirect() to call the myreport.aspx and display it.
The contents of the column looks like this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<h1>Welcome Aboard!</h1>
</body>
</html>
And also replace the contents with a new one whenever the page is being called.
I need help, thank you in advance, seniors!

Related

Angular template view with utf-8 chars doesn't work

I try to use "ngroute" to load html templates.
Everything works fine, but when I try to show words in Hebrew in the "ng-view", I get only question marks instead of the Hebrew chars (???????????).
in the <head> tag I added <meta charset="utf-8">
and if the Hebrew is static in the page it works fine.
but when I use "ngroute" to load it it doesn't.
<head>
<!-- start: Meta -->
<meta charset="utf-8">
<title></title>
<!-- end: Meta -->
<script src="js/angular.min.js"></script>
<script src="js/angular-route.min.js"></script>
<script src="js/controllers.js"></script>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- end: CSS --></head>
Any idea? Is there anything I should add to the html view page?
I added the <meta meta charset=utf-8> tag to the all the templates html and not just to the <head> and it fixed the problem.
I've solved by resaving the html template file with utf-8 encoding. In Visual Studio, Save As > Save with Encoding... button.
I ran into this issue as well for Danish characters and symbols.
I was missing the charset = utf-8 in /.editorconfig under the angular project!
So it defaulted to Windows-1251.
This worked for all new files and when resaving old ones with wrong encoding.

Broken iron-flex-layout dependency

I have a simplistic page:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="bower_components/iron-flex-layout/classes/iron-flex-layout.html">
</head>
<body class="fullbleed vertical layout" unresolved>
<div>Alpha</div>
<div class="flex">Beta (flex)</div>
<div>Gamma</div>
</body>
</html>
It is very near from there given samples for iron-flex-layout.
But it renders an empty page.
If I add another import, like iron-image, the page is displayed correctly.
It is served by polyserve, and everything is correctly installed otherwise.
Thanks for your help / explanation.
My bad here.
At this point unresolved body attribute is not defined.
Removing it makes it work as expected.
No clue where this attribute is defined, though (but importing an element such as iron-element, as mentioned above, and its dependencies makes it defined)

Ionic - meta charset doesn't work

In my index, I've inserted this:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
And if I use a special character (like à or •) in the index it's displayed correctly. For example, in the header I can use special character.
But if I use it in one of the view, it's display a exclamation point in a rhombus. Why?
I solved it myself.
I changed the file encodings in IntelliJ (setting -> editor -> file encodings).

c compiler on own website to test users input

i know my question sounds maybe a little bit stupid or unreachable but i will try:
Is there any existing tool in the WWW that i can use on my own website to test users c language input and display the output of it when existing?
I know there are sites like: http://ideone.com/ who does this and so it should be possible but how is it possible for a normal user to put something like this on his own website?
I already found this question on stackoverflow but idk if that is what i'm looking for.
Thanks
Edit1: I tried some hard coded html just for test this plugin without wp
<!DOCTYPE html>
<html>
<head>
<title>Test run-this Plugin</title>
<meta charset="UTF-8" />
<meta name="description" content="Kurzbeschreibung" />
<link href="run_this.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="run_this.js"></script>
<script language="javascript" type="text/javascript" src="jquery-1.3.2.js"></script>
</head>
<body>
<h2> C example</h2>
<pre lang="c" line="1" class="run-this">
#include <stdio.h>
int main (int argc, char** argv) {
printf("Hello, World!");
return 0;
}
</pre>
<div class="run-this-button">
<input type="button" value="Run" onclick='run_this(this, "c", "CSNpbmNsdWRlICZsdDtzdGRpby5oJmd0Ow0KDQoJaW50IG1haW4gKGludCBhcmdjLCBjaGFyKiogYXJndikgew0KCSAgcHJpbnRmKCJIZWxsbywgV29ybGQhIik7DQoJICByZXR1cm4gMDsNCgl9");'/>
<img class="run-this-spinner" src="spinner.gif"/>
</div>
<div class="run-this-details"></div>
</body>
</html>
but i get the error: XMLHttpRequest cannot load http://run-this.appspot.com/runthis. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Edit2:
Now it runs :) i just had to move the folder to a server and it works.
You might try something like this -
Have a python or any other way to run shell commands on your server
When the user want to run his page simply save it and run a shell command to the c compiler you have while having the output saved into another file
Read the output file and show it online.
This can be done, though i mind you that there are MANY MANY security holes that you must check before letting any code run on your server! Many people can use it to hack your server or even make it a part of a botnet.

Nancy - Super Simple View Engine: How do I override a MasterPage's title in the view?

I would like to set the title of each rendered page from the corresponding view. I would also like a default title to be set in my Master page. Here is the super-simple set up I am using.
Master Page
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>NancyFX is Splendid</title>
</head>
<body>
#Section['Content']
</body>
</html>
View
#Master['_Master']
#Section['Content']
<h1>Home</h1>
<p>Hello #Model.UserName</p>
#EndSection
I have tried a few of the more obvious guesses but no joy so far. Can you help?
On a more general note - is there any definitive help for Nancy's SSVE? I have read all the docs available on the site and GitHub but they are sparse. Just a list of all SSVE '#[]' keywords, would save me a lot of time.
Thanks
You can just render it from the model, same as anything else:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello #Model.Name!</title>
</head>
<body>
<h1>Super Simple View Engine</h1>
<p>This text is in the master page, it has access to the model:</p>
<p>Hello #Model.Name!<p>
#Section['Content']
</body>
</html>
As for documentation, most of the tags are documented here: https://github.com/grumpydev/SuperSimpleViewEngine although it's slightly out of date now. It was initially designed purely for internal use, but obviously you are welcome to use it if you want to. The best place to look if you get stuck is the tests, there's samples for all the tags in there.

Resources