mirror of
https://github.com/jakobadam/RDSFactor.git
synced 2025-06-13 07:54:33 +02:00
Simplify ...
This commit is contained in:
parent
01c78645ad
commit
917b38d77b
2 changed files with 33 additions and 95 deletions
|
@ -79,9 +79,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// gives us https://<machine>/rdweb/pages/<lang>/
|
// gives us https://<machine>/rdweb/pages/<lang>/
|
||||||
// baseUrl = new Uri(new Uri(Request.Url, Request.FilePath), ".");
|
baseUrl = new Uri(new Uri(GetRealRequestUri(), Request.FilePath), ".");
|
||||||
baseUrl = new Uri(new Uri(GetRealRequestUri(), Request.FilePath), ".");
|
|
||||||
|
|
||||||
sLocalHelp = ConfigurationManager.AppSettings["LocalHelp"];
|
sLocalHelp = ConfigurationManager.AppSettings["LocalHelp"];
|
||||||
if ((sLocalHelp != null) && (sLocalHelp == "true"))
|
if ((sLocalHelp != null) && (sLocalHelp == "true"))
|
||||||
{
|
{
|
||||||
|
@ -92,74 +90,17 @@
|
||||||
sHelpSourceServer = "http://go.microsoft.com/fwlink/?LinkId=141038";
|
sHelpSourceServer = "http://go.microsoft.com/fwlink/?LinkId=141038";
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
strPrivateModeTimeout = ConfigurationManager.AppSettings["PrivateModeSessionTimeoutInMinutes"].ToString();
|
|
||||||
strPublicModeTimeout = ConfigurationManager.AppSettings["PublicModeSessionTimeoutInMinutes"].ToString();
|
|
||||||
}
|
|
||||||
catch (Exception objException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
strPrivateModeTimeout = ConfigurationManager.AppSettings["PrivateModeSessionTimeoutInMinutes"];
|
||||||
{
|
strPublicModeTimeout = ConfigurationManager.AppSettings["PublicModeSessionTimeoutInMinutes"];
|
||||||
|
|
||||||
if (ConfigurationManager.AppSettings["OTP"].ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
bOTP = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bOTP = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception objException)
|
|
||||||
{
|
|
||||||
bOTP = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
if (ConfigurationManager.AppSettings["EnableSMS"].ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
bEnableSMS = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bEnableSMS = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception objException)
|
|
||||||
{
|
|
||||||
bEnableSMS = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
if (ConfigurationManager.AppSettings["EnableMail"].ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
bEnableMail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bEnableMail = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception objException)
|
|
||||||
{
|
|
||||||
bEnableMail = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bOTP = ConfigurationManager.AppSettings["OTP"] == "true";
|
||||||
|
bEnableSMS = ConfigurationManager.AppSettings["EnableSMS"] == "true";
|
||||||
|
bEnableMail = ConfigurationManager.AppSettings["EnableMail"] == "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Page_Load(object sender, EventArgs e)
|
void Page_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!Page.IsPostBack)
|
if (!Page.IsPostBack)
|
||||||
{
|
{
|
||||||
Session["UserPass"] = "";
|
Session["UserPass"] = "";
|
||||||
|
@ -310,30 +251,29 @@
|
||||||
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Uri GetRealRequestUri()
|
public static Uri GetRealRequestUri()
|
||||||
{
|
{
|
||||||
if ((HttpContext.Current == null) ||
|
if ((HttpContext.Current == null) ||
|
||||||
(HttpContext.Current.Request == null))
|
(HttpContext.Current.Request == null))
|
||||||
throw new ApplicationException("Cannot get current request.");
|
throw new ApplicationException("Cannot get current request.");
|
||||||
return GetRealRequestUri(HttpContext.Current.Request);
|
return GetRealRequestUri(HttpContext.Current.Request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Uri GetRealRequestUri(HttpRequest request)
|
public static Uri GetRealRequestUri(HttpRequest request)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(request.Headers["Host"]))
|
if (String.IsNullOrEmpty(request.Headers["Host"]))
|
||||||
return request.Url;
|
return request.Url;
|
||||||
UriBuilder ub = new UriBuilder(request.Url);
|
UriBuilder ub = new UriBuilder(request.Url);
|
||||||
string[] realHost = request.Headers["Host"].Split(':');
|
string[] realHost = request.Headers["Host"].Split(':');
|
||||||
string host = realHost[0];
|
string host = realHost[0];
|
||||||
ub.Host = host;
|
ub.Host = host;
|
||||||
string portString = realHost.Length > 1 ? realHost[1] : "";
|
string portString = realHost.Length > 1 ? realHost[1] : "";
|
||||||
int port;
|
int port;
|
||||||
if (int.TryParse(portString, out port))
|
if (int.TryParse(portString, out port))
|
||||||
ub.Port = port;
|
ub.Port = port;
|
||||||
return ub.Uri;
|
return ub.Uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SafeRedirect(string strRedirectUrl)
|
private void SafeRedirect(string strRedirectUrl)
|
||||||
{
|
{
|
||||||
string strRedirectSafeUrl = null;
|
string strRedirectSafeUrl = null;
|
||||||
|
@ -347,7 +287,7 @@ public static Uri GetRealRequestUri()
|
||||||
redirectUri.Scheme.Equals(Request.Url.Scheme)
|
redirectUri.Scheme.Equals(Request.Url.Scheme)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
strRedirectSafeUrl = redirectUri.AbsoluteUri;
|
strRedirectSafeUrl = redirectUri.AbsoluteUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -370,10 +310,9 @@ public static Uri GetRealRequestUri()
|
||||||
strRedirectSafeUrl = "smstoken.aspx";
|
strRedirectSafeUrl = "smstoken.aspx";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Response.Redirect(strRedirectSafeUrl);
|
Response.Redirect(strRedirectSafeUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<RDWAPage
|
<RDWAPage
|
||||||
helpurl="<%=sHelpSourceServer%>"
|
helpurl="<%=sHelpSourceServer%>"
|
||||||
|
|
|
@ -84,15 +84,14 @@
|
||||||
Label1.Text = (string)Session["Delivery"];
|
Label1.Text = (string)Session["Delivery"];
|
||||||
|
|
||||||
bool Debug = true;
|
bool Debug = true;
|
||||||
RADIUSClient myRadius = new RADIUSClient(RadiusServer, 1812, RadiusSecret);
|
RADIUSClient client = new RADIUSClient(RadiusServer, 1812, RadiusSecret);
|
||||||
RADIUSAttributes atts = new RADIUSAttributes();
|
RADIUSAttributes atts = new RADIUSAttributes();
|
||||||
RADIUSPacket response = default(RADIUSPacket);
|
client.Debug = Debug;
|
||||||
myRadius.Debug = Debug;
|
|
||||||
try {
|
try {
|
||||||
VendorSpecificAttribute vsa = new VendorSpecificAttribute(VendorSpecificType.Generic,(string)Session["Delivery"]);
|
VendorSpecificAttribute vsa = new VendorSpecificAttribute(VendorSpecificType.Generic,(string)Session["Delivery"]);
|
||||||
vsa.SetRADIUSAttribute(ref atts);
|
vsa.SetRADIUSAttribute(ref atts);
|
||||||
|
|
||||||
response = myRadius.Authenticate(username,strPassword, atts);
|
RADIUSPacket response = client.Authenticate(username, strPassword, atts);
|
||||||
|
|
||||||
if (response.Code == RadiusPacketCode.AccessChallenge) {
|
if (response.Code == RadiusPacketCode.AccessChallenge) {
|
||||||
state = response.Attributes.GetFirstAttribute(RadiusAttributeType.State);
|
state = response.Attributes.GetFirstAttribute(RadiusAttributeType.State);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue