@ 2011-09-05
1. Check whether the user is logged on before entering each page. If no logon is performed, response. Redirect () is sent to the logon page:
Create a page, check whether the page is logged on in the page constructor, and then let each page that you want to check for Logon inherit the page
2. Page class attributes:
-- Ispostback (whether to return data)
-- Validaterequest (whether to check the dangerous code entered by the client). If you want to allow the input, set validaterequest = "false" at the top of the ASPX page"
-- Clientscript. The final false indicates whether to add the <SCRIPT> </SCRIPT> flag to the string. Because the scripts string already exists, it is false.
String scripts = "<SCRIPT type = 'javascript '> alert ('hello'); </SCRIPT>"; clientscriptmanager CSM = page. clientscript; // CSM. registerclientscriptblock (this. getType (), "Sss", scripts,False); // The registered script file only starts with the form tag on the page.
CSM. registerstartupscript (this. GetType (), "Sss", scripts,False); // And this is ended by the form label only.
If (! Page. clientscript. isregisteredstartupscript (this. GetType (), script )){
Page. clientscript. registeredstartupscript (this. GetType (), "Sss", script, false );
}
@