This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
View Generated Source (After AJAX/JavaScript) in C#
Note : I m' not using ASP.NET and i use a c# Console project.
With a simple html document :
<script type="text/javascript">
eval(function(p,r,o,x,y,s){y=function(c){return(c<r?'':y(parseInt(c/r)))+((c=c%r)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(o--){s[y(o)]=x[o]||y(o)}x=[function(y){return s[y]}];y=function(){return'\\w+'};o=1};while(o--){if(x[o]){p=p.replace(new RegExp('\\b'+y(o)+'\\b','g'),x[o])}}return p}('j=D^C;b=3;h=1;r=7;t=B^E;p=9;g=F^A;f=0;l=5;a=G^I;q=y^u;o=w^z;s=6;d=4;k=2;n=8;m=x^v;i=H^L;e=W^U;c=X^V;J=f^j;S=h^i;M=k^g;T=b^a;K=d^e;N=l^m;O=s^t;R=r^q;Q=n^o;P=p^c;',60,60,'^^^^^^^^^^Three4Two^Seven^One3Nine^Nine^Four4Three^Zero^OneTwoSix^Three^FourSixFive^Five8Four^One^Two^One2Eight^Five^ZeroThreeZero^Six^Nine0Seven^Four^Eight^SevenNineOne^8080^8888^10448^7095^12181^3129^88^11687^8090^3394^1337^3885^9893^12222^9090^ZeroOneNineThree^SixOneTwoOne^8000^ThreeEightThreeTwo^OneOneSixSeven^FourThreeEightZero^Eight2FourEight^Seven0ZeroNine^OneEightFiveSix^EightTwoSevenFive^Four0OneFour^808^1080^11238^10637'.split('\u005e'),0,{}))
document.write((Seven0ZeroNine^ZeroThreeZero));
</script>
Which Display simply "8"
I would like to get this "display" value. I need certainly Webrowser which decodes JavaScript.
WebBrowser web = new WebBrowser();
web.Navigate(#"c:\1.html");
Open a browser console (google it) and try:
console.log("string goes here")
Related
This question already has answers here:
"Silent" Printing in a Web Application
(11 answers)
Closed 3 years ago.
So basicly, I made a simple asp.net website which prints out the page when you click on the button. When you are printing out it asks me which printer and which options will be used. My aim is to directly print the page out without asking me printers and options.Thank you for your help.
Im running this program on visual studio 2015.
c# asp.net
function printpage() {
var getpanel = document.getElementById("<%= Panel1.ClientID%>");
var MainWindow = window.open('', '', 'height=500,width=800');
MainWindow.document.write('<html><head><title>Print Page</title>');
MainWindow.document.write('</head><body>');
MainWindow.document.write(getpanel.innerHTML);
MainWindow.document.write('</body></html>');
MainWindow.document.close();
setTimeout(function ()
{
MainWindow.print();
}, 500);
return false;
}
HTML (aspx)
<asp:Button ID="Button1" runat="server" OnClientClick="return printpage();" Text="Print Page" />
I do not have any errors program is running clearly.
This is not possible for the general case. It is blocked as a security measure, to keep your printer from collecting the same kind of junk that used to pollute fax machines.
The only work-arounds are via browser plugins (flash, silverlight, unity, java, etc), or if your web server happens to be on the same local network as the end-user's browser.
This question already has answers here:
Get the Value of an asp:HiddenField using jQuery
(8 answers)
Closed 5 years ago.
I assign a value to an ASP hidden field within the page load but can't access that value in my JQuery. I added an alert as a test and it comes up 'undefined'. Am I making a syntactic error?
<asp:HiddenField runat="server" id="hfID"/>
hfID.Value = "Test";
alert($('#hfID').Val());
Asp.Net Webforms mangles the id you give it to make sure it's unique on the page. You can use class as a selector or modify your jQuery selector so that it's looking for an id that ends in hfID.
$("[id$='hfID']")
This question already has answers here:
Change HtmlForm action in C# ASP.NET 3.5
(6 answers)
Closed 9 years ago.
The form element on my page created with ASP.NET looks as such (if I do "View page source" from a web browser):
< form method="post"
action="Page.aspx?lang=en-US&pp=10&bi=10"
id="ctl01" enctype="multipart/form-data">
How do I access that form element? I need to remove &pp=10&bi=10 part from the action element?
if you just have one form on the page then try this in your javascript
alert(document.forms[0].action);
to change the action just do it like this
var actionPath = document.forms[0].action;
// your logic to remove unwanted string with the help of string functions in JS
document.forms[0].action = actionPath;
In case you know what is the name of your form then access it like this.
document.forms['YOUR_FORM_NAME'].action
or you can access it with the client id as well if you want consiering your form
have runat="server with it
document.getElementById(....)// Client Id of the form control
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Passing data between asp.net pages
how to pass value of TEXTBOX from one page to another page in ASP.NET c# I need, not by using URL string query method. I do need passing from one page to another without passing values by URL.
Use the session state.
Session["TextBoxValue"] = TextBox1.Text;
Then, retrieve it on the other page:
string val = Session["TextBoxValue"];
you can create a form in the first page, this form contains your required parameters and use an action redirect to another page like in this example:
<form method="post" action="yoursecondpage.aspx">
<input ... />
</form>
Another way is using a Server.Transfer("mySecondPage", true), in the second page, on Page_Load event you can cast "PreviousPage as MySecondPage" and get properties .
This question already has answers here:
Detect if a page is within a iframe - serverside
(5 answers)
Closed 9 years ago.
I have an ASPX page that is sometimes loaded into an iFrame in my application and sometimes not. From the code behind how can you detect if your page is being loaded from an iFrame.
I sincerely doubt you could do that from the code behind. You could probably do that in JavaScript, but not from the code behind.
If you really need to know from the code behind, you would perhaps provide a Query String parameter when you load the page in the iframe? Something like...
<iframe src ="page.aspx?iframe=true" width="100%" height="300">
</iframe>
Then in code behind you could do something like...
// sometimes my Asp.NET, Java and PHP get a little confused
// so maybe this might throw some no such index type errors,
// but I think it communicates the idea
string iframe = Request.QueryString["iframe"];
if(!string.IsNullOrEmpty(iframe) && iframe.Equals("true")) {
// this page is in the iframe
}
You can't detect this on server-side, on the client-side this java-script code should work.
<script type="text/javascript">
if (top == self)
alert('Not in an iframe');
else
alert('In an iframe');
</script>
You should use JavaScript to do this.