Home > Net >  I want to use inline code written in the ASPX, find information in the cannot write method, have an
I want to use inline code written in the ASPX, find information in the cannot write method, have an

Time:04-22

How to break
 & lt; Script language="c #" runat="server" & gt; 
Void loglog (object sender, EventArgs e)
{
String Path=@ "D: \ log \ log. TXT".
if (! System. IO. File. The Exists (Path))
{
System. IO. FileStream f=System. IO. File. Create (Path);
F. lose ();
F.D ispose ();
}
System. IO. StreamWriter f2=new System. IO. StreamWriter (Path, true,
System. Text. Encoding. GetEncoding (" gb2312 "));
F2. WriteLine (Request) [r]. "st" the ToString ());
F2. The Close ();
F2. The Dispose ();
}
</script>


Onclick="loglog" to invoke this method/function, I wanted to remove the definition in the beginning, and then put into each other & lt; % % & gt; Format, but so that the onclick below can not be called, and then the onclick="loglog inside and can't write" & lt; % % & gt; , because there is no written into the ASPX. CS file, no source, but I only want to add a function is enough , the DLL has been compiled, decompiled words like decompiling, the whole system can not get,

There are & lt; Script language="c #" runat="server" & gt; </script> The grammar in the local can run on the demo page, but not a big in the server's system inside the (browser page loading no problem, don't press the button to record information, also is not performing loglog, press F12 error message:
Log_lee. Aspx: 765 Uncaught ReferenceError: loglog is not defined at HTMLInputElement. The onclick)
, don't know why, whether the button control not to read the code in the page above, way in front of the public or the error, is not defined is not defined, but I clearly defines the ah, static Request here and error, CS0120 object references for non-static fields, methods, or properties "Page. The Request is necessary," added Control. The Page. And no,,, I check online for a long time, about the undefined error code is on JS, but I this is a c #, this is a riddle, and made for a long time, is why think impassability, about the inline code grammar question, I will open another post, I want to understand it, why not don't suspicion I repetitive, many people don't understand what I'm saying is,

There is a post before https://bbs.csdn.net/topics/399167291 some, grammatical errors, you must use & lt; % % & gt; The format,
  • Related