index.aspx.cs
5.66 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ADAM.AIA
{
public partial class index : System.Web.UI.Page
{
public string strIPAddress = "";
public bool bValidIP = false;
public string strAccountNumber = "";
public string strEdition = "";
public string strUrlReferer = "";
public string strSiteReferer = "";
public string urlParams = "";
public string test = "";
public bool isCalsCredantial = false;
public string version = "1.0." + DateTime.Now.Hour.ToString();//refresh script and css by adding version every hour
protected void Page_Load(object sender, EventArgs e)
{
if (Request.HttpMethod == "POST")
{
if (Request.Form["calsCredantial"] != null && Request.Form["calsCredantial"].ToString() == "yes")
{
isCalsCredantial = true;
urlParams = "calsCredantial=" + Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString();
//calsCredantialusername&password
// urlParams = Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString();
}
}
if (Request.QueryString["mtype"] != null)
{
//birendra
//open default CA module by query string
isCalsCredantial = true;
string[] allQueryData = new string[Request.QueryString.AllKeys.Length];
for(int i=0;i< Request.QueryString.AllKeys.Length; i++)
{
allQueryData[i] = Request.QueryString.AllKeys[i] + "=" + Request.QueryString[Request.QueryString.AllKeys[i]].ToString();
}
urlParams = string.Join("&", allQueryData);
//urlParams = "mtype=" + Request.QueryString[allQueryData[].ToString() + "&id=" + Request.QueryString["id"].ToString() + "&username=" + Request.QueryString["username"].ToString() + "&password=" + Request.QueryString["password"].ToString();
}
else if (Request.QueryString["account"] != null)
{
// http://stackoverflow.com/questions/9032005/request-servervariableshttp-referer-is-not-working-in-ie
// http://stackoverflow.com/questions/5643773/http-referrer-not-always-being-passed?rq=1
//
strSiteReferer = Request.ServerVariables["HTTP_REFERER"];
strAccountNumber = Request.QueryString["account"];
strEdition = Request.QueryString["edition"];
string remoteIPAddress = Request.ServerVariables["REMOTE_ADDR"];
string strHttpReferer = null;
int intSiteId = 0;
if (Request.Form["referer"] != null)
{
strUrlReferer = Request.Form["referer"];
}
else if (Request.QueryString["referer"] == null)
{
strUrlReferer = Request.ServerVariables["HTTP_REFERER"];
}
else if (Request.Params["referer"] != null)
{
strUrlReferer = Request.Params["referer"];
}
else
{
strUrlReferer = Request.QueryString["referer"];
}
if (strUrlReferer != "" && strUrlReferer != null)
{
strHttpReferer = strUrlReferer.ToLower().Replace("http://", "").Replace("https://", "").Replace("www.", "").ToString().Split('/')[0].ToString();
if (strHttpReferer.IndexOf(":") != -1)
{
char[] delimiters = new char[] { ':' };
string[] parts = strHttpReferer.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
strHttpReferer = parts[0];
}
}
try
{
if (strHttpReferer != "" && strHttpReferer != null)
strIPAddress = strHttpReferer;
if (strIPAddress == "" || strIPAddress == null)
strIPAddress = remoteIPAddress;
// intSiteId = LicenseHelper.GetInstance().ValidateLicenseSiteIP(strIPAddress, remoteIPAddress, strAccountNumber, Convert.ToByte(strEdition));
}
catch (Exception objEx)
{
}
//urlParams = "?siteIP=" + strIPAddress + "&status=" + intSiteId + "&accountNumber=" + strAccountNumber + "&edition=" + strEdition + "&urlReferer=" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "");
urlParams = "siteIP=" + strIPAddress + "&accountNumber=" + strAccountNumber + "&edition=" + strEdition + "&urlReferer=" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "") + "&remoteIPAddress=" + remoteIPAddress;
//For the ease of splitting desgined urlParms in the pattern of
//urlParams = siteIP&accountNumber&remoteIPAddress&edition&urlReferer; without mentioning the variableName
// urlParams = strIPAddress + "&" + remoteIPAddress+"&"+ strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "");
}
}
}
}