A few days ago, the training system reported two bugs, both of which were caused by webvpn access over the Internet. There was no problem with access over the Intranet. The problem is described as follows:
- Errors are reported on pages with magicajax, indicating that/ajaxcallobject. JS is not found.
- A bunch of icag strings appear on the exam page.
The first problem is that I think the path used is incorrect. So I searched for the generated HTML Dode and found that the connection was changed, but it can still be accessed, as a result, I tried to forcibly introduce this JS file. The problem persists. I copied the content of this JS file to the webpage. the problem persists. Put it down first and it is just a pop-up box, it does not affect the use of users, but it is just a little less elegant.
The second problem is to check what icag is. After comparing it with the HTML code generated during Intranet access, it is found that the segment before viewstate is final. The pile of icag is what is in viewstate.
Therefore, I think webvpn is somewhat biased towards viewstate, so I want to replace viewstate. How can I replace it?
I suddenly thought of the previous Article compressing viewstate, so a bit of Baidu found
The program is as follows: # region compresses viewstate
Protected override void savepagestatetopersistencemedium (Object pviewstate)
{
Losformatter mformat = new losformatter ();
Stringwriter mwriter = new stringwriter ();
Mformat. serialize (mwriter, pviewstate );
String mviewstatestr = mwriter. tostring ();
Byte [] pbytes = system. Convert. frombase64string (mviewstatestr );
Pbytes = compress (pbytes );
String vstatestr = system. Convert. tobase64string (pbytes );
Registerhiddenfield ("_ mspvstate", vstatestr );
}
Protected override object loadpagestatefrompersistencemedium ()
{
String vstate = This. Request. Form. Get ("_ mspvstate ");
Byte [] pbytes = system. Convert. frombase64string (vstate );
Pbytes = decompress (pbytes );
Losformatter mformat = new losformatter ();
Return mformat. deserialize (system. Convert. tobase64string (pbytes ));
}
Public static byte [] compress (byte [] pbytes)
{
Memorystream mmemory = new memorystream ();
Deflater mdeflater = new Deflater (icsharpcode. sharpziplib. Zip. Compression. Deflater. best_compression );
Icsharpcode. sharpziplib. Zip. Compression. Streams. deflateroutputstream mstream = new icsharpcode. sharpziplib. Zip. Compression. Streams. deflateroutputstream (mmemory, mdeflater, 131072 );
Mstream. Write (pbytes, 0, pbytes. Length );
Mstream. Close ();
Return mmemory. toarray ();
}
Public static byte [] decompress (byte [] pbytes)
{
Icsharpcode. sharpziplib. Zip. Compression. Streams. inflaterinputstream mstream = new icsharpcode. sharpziplib. Zip. Compression. Streams. inflaterinputstream (New memorystream (pbytes ));
Memorystream mmemory = new memorystream ();
Int32 msize;
Byte [] mwritedata = new byte [4096];
While (true)
{
Msize = mstream. Read (mwritedata, 0, mwritedata. Length );
If (msize> 0)
{
Mmemory. Write (mwritedata, 0, msize );
}
Else
{
Break;
}
}
Mstream. Close ();
Return mmemory. toarray ();
}
# Endregion
Run. The problem is solved successfully.