-
Notifications
You must be signed in to change notification settings - Fork 1
/
FlexibleTennisLeague.Master.cs
42 lines (40 loc) · 1.48 KB
/
FlexibleTennisLeague.Master.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FlexibleTennisLeague
{
public partial class FlexibleTennisLeague : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
if (!Request.Url.AbsolutePath.Contains("Users"))
{
System.IO.StringWriter stringWriter = new System.IO.StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
base.Render(htmlWriter);
string html = stringWriter.ToString();
int StartPoint = html.IndexOf("<input type=\"hidden\" name=\"__VIEWSTATE\"");
if (StartPoint >= 0)
{
int EndPoint = html.IndexOf("/>", StartPoint) + 2;
string viewstateInput = html.Substring(StartPoint, EndPoint - StartPoint);
html = html.Remove(StartPoint, EndPoint - StartPoint);
int FormEndStart = html.IndexOf("</form>") - 1;
if (FormEndStart >= 0)
{
html = html.Insert(FormEndStart, viewstateInput);
}
}
writer.Write(html);
}
else
base.Render(writer);
}
}
}