as you see,please tell me why
-
a.aspx
function btnLogin_onclick() {
var NumRandom = document.getElementById("lblRandom").value;
if (compare()) {
var str = '<%=WebEncrypt("' + NumRandom + '")%>';
document.write(str);
}a.aspx.cs
public string WebEncrypt(string Text)
{
//return DESEncrypt.Encrypt(Text); //DES
return Text;
}:sigh: it returns '+NumRandom+',Whyyyyyyyyyyyyy.....
-
a.aspx
function btnLogin_onclick() {
var NumRandom = document.getElementById("lblRandom").value;
if (compare()) {
var str = '<%=WebEncrypt("' + NumRandom + '")%>';
document.write(str);
}a.aspx.cs
public string WebEncrypt(string Text)
{
//return DESEncrypt.Encrypt(Text); //DES
return Text;
}:sigh: it returns '+NumRandom+',Whyyyyyyyyyyyyy.....
Yaa... I think you dont know the basics of Web programming right. Let me explain you. In case of Web Applications, if you write server tag like
<% %>
it will get replaced in response. Therefore, anything in the server tag is evaluated when the actual page is rendered. But as javascript runs in the browser, it will run after all the page processing is done and the response in the browser. You cant call a server method this way using server tag. You need to use AJAX to call server methods. You might useICallbackEventHandler
orPageMethods
or your custom AJAX to do this job. But seriously, you cant pass value of javascript variable this way.. :cool:Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
Yaa... I think you dont know the basics of Web programming right. Let me explain you. In case of Web Applications, if you write server tag like
<% %>
it will get replaced in response. Therefore, anything in the server tag is evaluated when the actual page is rendered. But as javascript runs in the browser, it will run after all the page processing is done and the response in the browser. You cant call a server method this way using server tag. You need to use AJAX to call server methods. You might useICallbackEventHandler
orPageMethods
or your custom AJAX to do this job. But seriously, you cant pass value of javascript variable this way.. :cool:Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET:laugh: thanks