Skip to content

Commit fc9c51e

Browse files
Update Execute.cs
1 parent 0c1f1f5 commit fc9c51e

File tree

1 file changed

+7
-46
lines changed

1 file changed

+7
-46
lines changed

class/Execute.cs

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -43,43 +43,7 @@ private string RunByContext(HttpContext context, string MethodName, string Query
4343
if (extension == ".aspx" || HasSection)
4444
{
4545
// Add QueryString Value
46-
if (!string.IsNullOrEmpty(QueryString))
47-
{
48-
NameCollection QueryValues = new NameCollection();
49-
QueryString TmpQueryString = new QueryString();
50-
string[] QueryElements = QueryString.Split('&');
51-
foreach (string element in QueryElements)
52-
{
53-
string[] NameValue = element.Split('=');
54-
55-
if (NameValue.Length > 1)
56-
TmpQueryString = TmpQueryString.Add(NameValue[0], NameValue[1]);
57-
else
58-
TmpQueryString = TmpQueryString.Add(NameValue[0], "");
59-
60-
QueryValues.Add(NameValue[0]);
61-
}
62-
63-
string RequestQueryString = context.Request.QueryString.Value;
64-
65-
if (!string.IsNullOrEmpty(RequestQueryString))
66-
{
67-
RequestQueryString = RequestQueryString.GetTextAfterValue("?");
68-
string[] TmpQueryElements = RequestQueryString.Split('&');
69-
foreach (string element in TmpQueryElements)
70-
{
71-
string[] NameValue = element.Split('=');
72-
73-
if (!QueryValues.Exist(NameValue[0]))
74-
if (NameValue.Length > 1)
75-
TmpQueryString = TmpQueryString.Add(NameValue[0], NameValue[1]);
76-
else
77-
TmpQueryString = TmpQueryString.Add(NameValue[0], "");
78-
}
79-
}
80-
81-
context.Request.QueryString = TmpQueryString;
82-
}
46+
new RequestQuery().AddQueryString(context, QueryString);
8347

8448
if (context.Request.ContentType == null)
8549
context.Request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
@@ -251,16 +215,14 @@ public string RunFullPath(string path)
251215

252216
public string RunErrorPage(int ErrorValue)
253217
{
254-
CodeBehindOptions option = new CodeBehindOptions();
255-
string path = option.ErrorPagePath.Replace("{value}", ErrorValue.ToString());
218+
string path = StaticObject.ErrorPagePathBeforeValue + ErrorValue + StaticObject.ErrorPagePathAfterValue;
256219

257220
return Run(path);
258221
}
259222

260223
public string RunErrorPage(int ErrorValue, HttpContext context)
261224
{
262-
CodeBehindOptions option = new CodeBehindOptions();
263-
string path = option.ErrorPagePath.Replace("{value}", ErrorValue.ToString());
225+
string path = StaticObject.ErrorPagePathBeforeValue + ErrorValue + StaticObject.ErrorPagePathAfterValue;
264226

265227
context.Response.StatusCode = ErrorValue;
266228

@@ -368,8 +330,7 @@ public string RunController(string ControllerClass, HttpContext context, bool Is
368330
bool HasPostBack = false;
369331

370332
if (context.Request.Headers.TryGetValue("Post-Back", out var value))
371-
if (value == "true")
372-
HasPostBack = true;
333+
HasPostBack = (value == "true");
373334

374335
if (HasPostBack)
375336
{
@@ -414,7 +375,9 @@ public string RunRoute(HttpContext context, int ControllerSection)
414375
return "";
415376
}
416377

417-
if (string.IsNullOrEmpty(Section.GetValue(ControllerSection)))
378+
string ControllerClass = Section.GetValue(ControllerSection);
379+
380+
if (string.IsNullOrEmpty(ControllerClass))
418381
{
419382
if (StaticObject.UseDefaultController)
420383
return RunController(StaticObject.DefaultController, context, true);
@@ -425,8 +388,6 @@ public string RunRoute(HttpContext context, int ControllerSection)
425388
}
426389
}
427390

428-
string ControllerClass = Section.GetValue(ControllerSection);
429-
430391
return RunController(ControllerClass, context);
431392
}
432393

0 commit comments

Comments
 (0)