how to stop application asp.net with global.asax -
i want stop application asp.net mvc in session_start
after test , show user isn't authorized application
protected void session_start(object sender, eventargs e) { if (test) { //stop application // user : not authorized } }
finally send response , close session , works
protected void session_start(object sender, eventargs e) { if (test) { asciiencoding encoding = new asciiencoding(); string postdata = "<h2 style=\"color:red;\">vous n'avez pas l'authorisation pour utiliser application!!</h2>. "; byte[] data = encoding.getbytes(postdata); char[] buf = postdata.tochararray(); httpcontext.current.response.write(buf, 0, buf.count()); httpcontext.current.response.flush(); httpcontext.current.applicationinstance.completerequest(); session.abandon(); } }
Comments
Post a Comment