public override HttpBrowserCapabilities GetBrowserCapabilities(HttpRequest request) { HttpBrowserCapabilities bcap = new HttpBrowserCapabilities(); bcap.capabilities = HttpCapabilitiesBase.GetConfigCapabilities(null, request).Capabilities; return bcap; }
protected void Page_Load(object sender, EventArgs e) { //一些HttpRequest的属性和方法 _request = HttpContext.Current.Request; ApplicationPath = _request.ApplicationPath; AppRelativeCurrentExecutionFilePath = _request.AppRelativeCurrentExecutionFilePath; Browser = _request.Browser; FilePath = _request.FilePath; Path = _request.Path; Url = _request.Url; MachinePath = _request.MapPath(Path); //关于QueryString,Form属性的类型都是NameValueCollection //它这个集合类型有一个特点:允许在一个键下存储多个字符串值 string[] allkeys = Request.QueryString.AllKeys; if (allkeys.Length == 0) Response.Redirect( Request.RawUrl + "?aa=1&bb=2&cc=3&aa=" + HttpUtility.UrlEncode("5"), true); StringBuilder sb = new StringBuilder(); foreach (string key in allkeys) sb.AppendFormat("{0} = {1}<br />", HttpUtility.HtmlEncode(key), HttpUtility.HtmlEncode(Request.QueryString[key])); labResult.Text = sb.ToString(); }
/// <summary> /// Updates the capabilities used by Microsoft's implementation of the /// HttpBrowserCapabilities class to control the property values it /// returns. Only properties exposed by FiftyOneBrowserCapabilities are overriden /// by this method. /// </summary> /// <param name="capabilities">Dictionary of capabilities to be enhanced.</param> /// <param name="currentCapabilities">Dictionary of existing capabilities for the device.</param> /// <param name="results">The match result to use for the enhancement.</param> private static void Enhance( IDictionary capabilities, HttpBrowserCapabilities currentCapabilities, SortedList <string, string[]> results) { // Set base capabilities for all mobile devices. SetStaticValues(capabilities); SetValue(capabilities, "isMobileDevice", GetIsMobileDevice(results)); SetValue(capabilities, "crawler", GetIsCrawler(results)); SetValue(capabilities, "mobileDeviceModel", GetMobileDeviceModel(results)); SetValue(capabilities, "mobileDeviceManufacturer", GetMobileDeviceManufacturer(results)); SetValue(capabilities, "platform", GetPlatform(results)); // property enhancement can be removed with this compiler flag #if !REMOVE_OVERRIDE_BROWSER SetValue(capabilities, "browser", GetBrowser(results)); #endif SetValue(capabilities, "type", capabilities["mobileDeviceManufacturer"]); SetValue(capabilities, "screenPixelsHeight", GetScreenPixelsHeight(results) ?? GetDefaultValue("screenPixelsHeight", currentCapabilities)); SetValue(capabilities, "screenPixelsWidth", GetScreenPixelsWidth(results) ?? GetDefaultValue("screenPixelsWidth", currentCapabilities)); SetValue(capabilities, "screenBitDepth", GetBitsPerPixel(results)); SetValue(capabilities, "preferredImageMime", GetPreferredImageMime(results)); SetValue(capabilities, "isColor", GetIsColor(results)); SetValue(capabilities, "supportsCallback", GetSupportsCallback(results)); SetValue(capabilities, "SupportsCallback", GetSupportsCallback(results)); SetValue(capabilities, "canInitiateVoiceCall", GetIsMobileDevice(results)); SetValue(capabilities, "jscriptversion", GetJavascriptVersion(results)); // The following values are set to prevent exceptions being thrown in // the standard .NET base classes if the property is accessed. SetValue(capabilities, "screenCharactersHeight", GetDefaultValue("screenCharactersHeight", currentCapabilities)); SetValue(capabilities, "screenCharactersWidth", GetDefaultValue("screenCharactersWidth", currentCapabilities)); // Use the Version class to find the version. If this fails use the 1st two // decimal segments of the string. string versionValue = results.GetString("BrowserVersion"); if (versionValue != null) { #if VER4 Version version = null; if (Version.TryParse(versionValue, out version)) { SetVersion(capabilities, version); } else { SetVersion(capabilities, versionValue.ToString()); } #else try { SetVersion(capabilities, new Version(versionValue)); } catch (FormatException) { SetVersion(capabilities, versionValue.ToString()); } catch (ArgumentException) { SetVersion(capabilities, versionValue.ToString()); } #endif } else { // Transfer the current version capabilities to the new capabilities. SetValue(capabilities, "majorversion", currentCapabilities != null ? currentCapabilities["majorversion"] : null); SetValue(capabilities, "minorversion", currentCapabilities != null ? currentCapabilities["minorversion"] : null); SetValue(capabilities, "version", currentCapabilities != null ? currentCapabilities["version"] : null); // Ensure the version values are not null to prevent null arguement exceptions // with some controls. var versionString = currentCapabilities != null ? currentCapabilities["version"] as string : "0.0"; SetVersion(capabilities, versionString); } // All we can determine from the device database is if javascript is supported as a boolean. // If the value is not provided then null is returned and the capabilities won't be altered. var javaScript = GetJavascriptSupport(results); if (javaScript.HasValue) { SetJavaScript(capabilities, javaScript.Value); SetValue(capabilities, "ecmascriptversion", (bool)javaScript ? "3.0" : "0.0"); } // Sets the W3C DOM version. SetValue(capabilities, "w3cdomversion", GetW3CDOMVersion(results, currentCapabilities != null ? (string)currentCapabilities["w3cdomversion"] : String.Empty)); // Update the cookies value if we have additional information. SetValue(capabilities, "cookies", GetCookieSupport(results, currentCapabilities != null ? (string)currentCapabilities["cookies"] : String.Empty)); // Only set these values from 51Degrees.mobi if they've not already been set from // the Http request header, or the .NET solution. if (capabilities.Contains("preferredRenderingType") == false) { // Set the rendering type for the response. SetValue(capabilities, "preferredRenderingType", GetPreferredHtmlVersion(results)); // Set the Mime type of the response. SetValue(capabilities, "preferredRenderingMime", "text/html"); } }
// We need to call the .ctor of SimpleWorkerRequest that depends on HttpRuntime so for unit testing // simply create the browser capabilities by going directly through the factory. private static HttpBrowserCapabilitiesBase CreateBrowserThroughFactory(string userAgent) { HttpBrowserCapabilities browser = new HttpBrowserCapabilities { Capabilities = new Dictionary<string, string> { { String.Empty, userAgent } } }; BrowserCapabilitiesFactory factory = new BrowserCapabilitiesFactory(); factory.ConfigureBrowserCapabilities(new NameValueCollection(), browser); return new HttpBrowserCapabilitiesWrapper(browser); }
/// <summary>构造函数 /// </summary> public ClientHelper(HttpRequest Request) { bc = Request.Browser; }
private void Page_Load(object sender, System.EventArgs e) { Response.Write("Response.Write#1<br>"); ParagraphRequest.Text = ""; ParagraphRequest.Text += "Request.ApplicationPath: \"" + Request.ApplicationPath + "\"<br>"; HttpBrowserCapabilities bc = Request.Browser; ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Browser Capabilities:<br>"; ParagraphRequest.Text += "Type = " + bc.Type + "<br>"; ParagraphRequest.Text += "Name = " + bc.Browser + "<br>"; ParagraphRequest.Text += "Version = " + bc.Version + "<br>"; ParagraphRequest.Text += "Major Version = " + bc.MajorVersion + "<br>"; ParagraphRequest.Text += "Minor Version = " + bc.MinorVersion + "<br>"; ParagraphRequest.Text += "Platform = " + bc.Platform + "<br>"; ParagraphRequest.Text += "Is Beta = " + bc.Beta + "<br>"; ParagraphRequest.Text += "Is Crawler = " + bc.Crawler + "<br>"; ParagraphRequest.Text += "Is AOL = " + bc.AOL + "<br>"; ParagraphRequest.Text += "Is Win16 = " + bc.Win16 + "<br>"; ParagraphRequest.Text += "Is Win32 = " + bc.Win32 + "<br>"; ParagraphRequest.Text += "Supports Frames = " + bc.Frames + "<br>"; ParagraphRequest.Text += "Supports Tables = " + bc.Tables + "<br>"; ParagraphRequest.Text += "Supports Cookies = " + bc.Cookies + "<br>"; ParagraphRequest.Text += "Supports VB Script = " + bc.VBScript + "<br>"; ParagraphRequest.Text += "Supports JavaScript = " + bc.JavaScript + "<br>"; ParagraphRequest.Text += "Supports Java Applets = " + bc.JavaApplets + "<br>"; ParagraphRequest.Text += "Supports ActiveX Controls = " + bc.ActiveXControls + "<br>"; ParagraphRequest.Text += "CDF = " + bc.CDF + "<br>"; ParagraphRequest.Text += "W3CDomVersion = " + bc.W3CDomVersion + "<br>"; ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.CurrentExecutionFilePath: \"" + Request.CurrentExecutionFilePath + "\"<br>"; ParagraphRequest.Text += "Request.FilePath: \"" + Request.FilePath + "\"<br>"; ParagraphRequest.Text += "Request.HttpMethod: \"" + Request.HttpMethod + "\"<br>"; ParagraphRequest.Text += "Request.IsAuthenticated: \"" + Request.IsAuthenticated + "\"<br>"; ParagraphRequest.Text += "Request.IsSecureConnection: \"" + Request.IsSecureConnection + "\"<br>"; string[] array1, array2; int i, ii; ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.Params.Count: \"" + Request.Params.Count + "\"<br>"; array1 = Request.Params.AllKeys; for (i = 0; i < array1.Length; ++i) { ParagraphRequest.Text += "Key [" + Convert.ToString(i) + "]=" + Server.HtmlEncode(array1[i]) + "<br>"; array2 = Request.Params.GetValues(array1[i]); for (ii = 0; ii < array2.Length; ++ii) { ParagraphRequest.Text += "Value [" + Convert.ToString(ii) + "]=" + Server.HtmlEncode(array2[ii]) + "<br>"; } } ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.Path: \"" + Request.Path + "\"<br>"; ParagraphRequest.Text += "Request.PathInfo: \"" + Request.PathInfo + "\"<br>"; ParagraphRequest.Text += "Request.PhysicalApplicationPath: \"" + Request.PhysicalApplicationPath + "\"<br>"; ParagraphRequest.Text += "Request.PhysicalPath: \"" + Request.PhysicalPath + "\"<br>"; ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.QueryString.Count: \"" + Request.QueryString.Count + "\"<br>"; array1 = Request.QueryString.AllKeys; for (i = 0; i < array1.Length; ++i) { ParagraphRequest.Text += "Key [" + Convert.ToString(i) + "]=" + Server.HtmlEncode(array1[i]) + "<br>"; array2 = Request.QueryString.GetValues(array1[i]); for (ii = 0; ii < array2.Length; ++ii) { ParagraphRequest.Text += "Value [" + Convert.ToString(ii) + "]=" + Server.HtmlEncode(array2[ii]) + " (" + array2[ii] + ")<br>"; } } ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.RawUrl: \"" + Request.RawUrl + "\"<br>"; ParagraphRequest.Text += "Request.RequestType: \"" + Request.RequestType + "\"<br>"; ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.ServerVariables.Count: \"" + Request.ServerVariables.Count + "\"<br>"; array1 = Request.ServerVariables.AllKeys; for (i = 0; i < array1.Length; ++i) { ParagraphRequest.Text += "Key [" + Convert.ToString(i) + "]=" + Server.HtmlEncode(array1[i]) + "<br>"; array2 = Request.ServerVariables.GetValues(array1[i]); for (ii = 0; ii < array2.Length; ++ii) { ParagraphRequest.Text += "Value [" + Convert.ToString(ii) + "]=" + Server.HtmlEncode(array2[ii]) + "<br>"; } } ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.Url.AbsolutePath: \"" + Request.Url.AbsolutePath + "\"<br>"; ParagraphRequest.Text += "Request.Url.AbsoluteUri: \"" + Request.Url.AbsoluteUri + "\"<br>"; ParagraphRequest.Text += "Request.Url.Authority: \"" + Request.Url.Authority + "\"<br>"; ParagraphRequest.Text += "Request.Url.Fragment: \"" + Request.Url.Fragment + "\"<br>"; ParagraphRequest.Text += "Request.Url.Host: \"" + Request.Url.Host + "\"<br>"; ParagraphRequest.Text += "Request.Url.HostNameType: \"" + Request.Url.HostNameType + "\"<br>"; ParagraphRequest.Text += "Request.Url.LocalPath: \"" + Request.Url.LocalPath + "\"<br>"; ParagraphRequest.Text += "Request.Url.PathAndQuery: \"" + Request.Url.PathAndQuery + "\"<br>"; string tmpString = Server.UrlDecode(Request.Url.PathAndQuery); tmpString = HttpUtility.UrlDecode(Request.Url.PathAndQuery); ParagraphRequest.Text += "Request.Url.Query: \"" + Request.Url.Query + "\"<br>"; ParagraphRequest.Text += "Request.Url.Scheme: \"" + Request.Url.Scheme + "\"<br>"; array1 = Request.Url.Segments; for (i = 0; i < array1.Length; ++i) { ParagraphRequest.Text += "Request.Url.Segments [" + Convert.ToString(i) + "]=" + array1[i] + "<br>"; } ParagraphRequest.Text += "Request.Url.UserEscaped: \"" + Request.Url.UserEscaped.ToString() + "\"<br>"; ParagraphRequest.Text += "Request.Url.UserInfo: \"" + Request.Url.UserInfo + "\"<br>"; if (Request.UrlReferrer != null) { ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.UrlReferrer.AbsolutePath: \"" + Request.UrlReferrer.AbsolutePath + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.AbsoluteUri: \"" + Request.UrlReferrer.AbsoluteUri + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.Authority: \"" + Request.UrlReferrer.Authority + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.Fragment: \"" + Request.UrlReferrer.Fragment + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.Host: \"" + Request.UrlReferrer.Host + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.HostNameType: \"" + Request.UrlReferrer.HostNameType + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.LocalPath: \"" + Request.UrlReferrer.LocalPath + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.PathAndQuery: \"" + Request.UrlReferrer.PathAndQuery + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.Query: \"" + Request.UrlReferrer.Query + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.Scheme: \"" + Request.UrlReferrer.Scheme + "\"<br>"; array1 = Request.UrlReferrer.Segments; for (i = 0; i < array1.Length; ++i) { ParagraphRequest.Text += "Request.UrlReferrer.Segments [" + Convert.ToString(i) + "]=" + array1[i] + "<br>"; } ParagraphRequest.Text += "Request.UrlReferrer.UserEscaped: \"" + Request.UrlReferrer.UserEscaped.ToString() + "\"<br>"; ParagraphRequest.Text += "Request.UrlReferrer.UserInfo: \"" + Request.UrlReferrer.UserInfo + "\"<br>"; } ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.UserAgent: \"" + Request.UserAgent + "\"<br>"; ParagraphRequest.Text += "Request.UserHostAddress: \"" + Request.UserHostAddress + "\"<br>"; ParagraphRequest.Text += "Request.UserHostName: \"" + Request.UserHostName + "\"<br>"; ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "Request.UserLanguages.Length: \"" + Request.UserLanguages.Length + "\"<br>"; array1 = Request.UserLanguages; for (i = 0; i < array1.Length; ++i) { ParagraphRequest.Text += "User Language [" + Convert.ToString(i) + "]=" + array1[i] + "<br>"; } ParagraphRequest.Text += "<br>"; ParagraphRequest.Text += "IsPostBack=" + IsPostBack.ToString().ToLower(); Response.Write("Response.Write#2<br>"); if (!IsPostBack) { } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); if (Page.IsValid) { if (btnSubmit.Text == "Submit") { #region rti_data_for_applicant bl.RTI_data_id = dl.max_RTI_Data_id(); bl.Rti_id = "2017000056"; // Need to get it from Session bl.Action_id = "002"; // Need to get it from Session //bl.RTI_fileID = ""; // Insert file first if is File Upload is true considerd in file upload section bl.Userid = "lkverma"; // Need to get it from session [rti_prepared_emp] bl.Office_mapping_id = "201700021001"; // Need to get it from either session or database. bl.Result_description = txt_description.Text; bl.IsMeeting = RadioMeeting.SelectedValue; #region meeting if (RadioMeeting.SelectedValue == "Y") { bl.Meeting_date = txt_meeting.Text; if (bl.Meeting_date != "") { bl.Meeting_date = getDate(txt_meeting.Text); } else { bl.Meeting_date = ""; } } else { bl.Meeting_date = null; } #endregion meeting bl.IsAdditionalFees = rbl_additional_fees.SelectedValue; #region Additional Fees if (bl.IsAdditionalFees == "Y") { bl.Fees_amount = txt_amount.Text; } else { bl.Fees_amount = null; } #endregion Additional Fees HttpBrowserCapabilities browse = Request.Browser; bl.Ipaddress = ul.GetClientIpAddress(this.Page); bl.Useragent = Request.UserAgent.ToString(); bl.Useros = Utilities.System_Info(this.Page); bl.User_browser = browse.Browser; #endregion rti_data_for_applicant bl.Is_file_upload = ddl_fileup.SelectedValue; #region file upload bl.RTI_fileID = ""; if (ddl_fileup.SelectedValue == "Y") { if (fu_action.HasFile) { if (txt_file_desc.Text != "") { HttpPostedFile file = fu_action.PostedFile; if (file.ContentLength < 2000000) { if (file.ContentType == "application/pdf" || file.ContentType == "application/x-pdf" || file.ContentType == "application/x-unknown") { bl.RTI_fileID = dl.max_file_id(); Stream fs = file.InputStream; BinaryReader br = new BinaryReader(fs); byte[] bytes = br.ReadBytes((Int32)fs.Length); bl.RTI_fileName = file.FileName; bl.RTI_fileType = file.ContentType; bl.RTI_fileData = bytes; bl.FileDescription = txt_file_desc.Text; rb = dl.Insert_Action_Info(bl); if (rb.status == true) { Utilities.MessageBox_UpdatePanel_Redirect(udp, "Action Submitted Successfully", "../Employee/EmployeeWelcome_Page.aspx"); } else { Utilities.MessageBox_UpdatePanel(udp, "Action Not Submitted"); } } else { Utilities.MessageBox_UpdatePanel(udp, "Only PDF type File will be accepted"); } } else { Utilities.MessageBox_UpdatePanel(udp, "Your file size is greater than 2 MB "); } } else { Utilities.MessageBox_UpdatePanel(udp, "File Description Is Required"); } } else { Utilities.MessageBox_UpdatePanel(udp, "PDF File required"); } } #endregion else { rb = dl.Insert_Action_Info(bl); if (rb.status == true) { Utilities.MessageBox_UpdatePanel_Redirect(udp, "Data Submitted Successfully", "../Employee/EmployeeWelcome_Page.aspx"); } else { Utilities.MessageBox_UpdatePanel(udp, "Data Not Submitted"); } } //Response.Write("Success"); } } } }
public RegexWorker (HttpBrowserCapabilities browserCaps) { }
private string ReplaceIf(Match m) { string cond = m.Groups[2].Value; HttpBrowserCapabilities browser = ctx.UnderlyingContext.Request.Browser; Match mCond = rxCond.Match(cond); bool ok = mCond.Success; string id = mCond.Groups["id"].Value; if (id == "FF" || id == "FFX") { id = "Firefox"; } else if (id == "OP") { id = "Opera"; } else if (id == "SA") { id = "Safari"; } ok &= String.Compare(browser.Browser, id, true) == 0; int? major = null; float?minor = null; if (ok && mCond.Groups["major"].Success) { bool plus = mCond.Groups["plus"].Value == "+"; major = Convert.ToInt32(mCond.Groups["major"].Value); if (mCond.Groups["minor"].Success) { minor = Convert.ToSingle("0" + mCond.Groups["minor"].Value, CultureInfo.InvariantCulture); } bool majorExact = browser.MajorVersion == major; ok &= majorExact || (plus && browser.MajorVersion > major); if (minor.HasValue) { ok &= !majorExact || browser.MinorVersion == minor.Value || (plus && browser.MinorVersion > minor.Value); } } if (mCond.Groups["not"].Success) { ok = !ok; } string rule = m.Groups[1].Value; if (ok) { return(rule); } if (proc.Debug) { return(String.Format(CultureInfo.InvariantCulture, "/* [debug] browser: '{0}{1}{2:.0}' cond: '{3}{4}{5:.0}' rule: '{6}' */", browser.Browser, browser.MajorVersion, browser.MinorVersion, id, major, minor, rule)); } return(String.Empty); }
private void Page_Load(object sender, System.EventArgs e) { System.Web.UI.HtmlControls.HtmlForm frm = (HtmlForm)FindControl("Form1"); GHTTestBegin(frm); // =================================== // testing if the Browser object is set // =================================== this.GHTSubTestBegin("Request.Browser1"); try { if (this.Request.Browser == null) { this.GHTSubTestAddResult("Failed"); } else { this.GHTSubTestAddResult("Success"); } } catch (Exception ex) { this.GHTSubTestAddResult("unxpected " + ex.GetType().Name + " exception was caught-" + ex.Message); } this.GHTSubTestEnd(); // =================================== // testing if the objects return is from the // correct type // =================================== this.GHTSubTestBegin("Request.Browser2"); try { HttpBrowserCapabilities capabilities1 = this.Request.Browser; this.GHTSubTestAddResult("success"); } catch (Exception ex) { this.GHTSubTestAddResult("Unxpected " + ex.GetType().Name + " exception was caught-" + ex.Message); } this.GHTSubTestEnd(); // =================================== // testing if the Browser contains the // right context. This is basic testing // a more rigorous testing needs to be included // in the HTTPBrowserCapabilities object // =================================== GHTSubTestBegin("Request.Browser3"); try { HttpBrowserCapabilities capabilities2 = this.Request.Browser; this.GHTSubTestAddResult(capabilities2.Browser); } catch (Exception ex) { GHTSubTestAddResult("Unxpected " + ex.GetType().Name + " exception was caught-" + ex.Message); } GHTSubTestEnd(); // =================================== // testing if the Browser contains the // right context. This is basic testing // a more rigorous testing needs to be included // in the HTTPBrowserCapabilities object // =================================== GHTSubTestBegin("Request.Browser4"); try { HttpBrowserCapabilities brw = Request.Browser; GHTSubTestAddResult(brw.MajorVersion.ToString() + "." + brw.MinorVersion.ToString()); } catch (Exception ex) { GHTSubTestAddResult("Unxpected " + ex.GetType().Name + " exception was caught-" + ex.Message); } GHTSubTestEnd(); GHTTestEnd(); }
protected void btn_Submit_Click1(object sender, EventArgs e) { if (Page.IsValid) { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); bool cptch_expired = false; try { Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim()); } catch { cptch_expired = true; } txtCaptcha.Text = ""; if (!cptch_expired) { if (Captcha1.UserValidated) { Captcha1.DataBind(); dl_RTI_Registration dl = new dl_RTI_Registration(); bl_RTI_Request objBL = new bl_RTI_Request(); dl_RTI_Request objDl = new dl_RTI_Request(); // set data for rti_request objBL.RTI_Request_id = objDl.Get_unique_RtiRequest_code(); //"<NTC>RTI Request ID from DL";//objDl.GetMaxValue("SELECT IFNULL(MAX(rti_request_id),0) as NO FROM rti_detail "); objBL.UserType = ddl_usertype.SelectedItem.Value; objBL.NameEnglish = txtName.Text; objBL.Gender = DDL_Gender.SelectedItem.Value; objBL.Email = txtEmailID.Text; objBL.Address = txtAddress.Text; objBL.Country = ddl_country.SelectedItem.Value; objBL.Securitycode = dl.GenOTPString(4); HttpBrowserCapabilities browse = Request.Browser; objBL.UserAgent = Request.UserAgent.ToString(); objBL.Client_os = Utilities.System_Info(this.Page); objBL.ClientBrowser = browse.Browser; objBL.IsRTIFileUpload = "N"; objBL.IsNew = "Y"; if (objBL.Country == "091") { objBL.State = DDL_State.SelectedItem.Value; objBL.District = ddl_district.SelectedItem.Value; objBL.CountryName = null; } else { objBL.CountryName = txtState_Other.Text; } objBL.Pincode = txtPinCode.Text; objBL.Mobile = txtMobile.Text; objBL.Rti_Subject = txt_subject.Text; objBL.RTI_Text = txt_RequestApplicationText.Text; objBL.RTI_login_userName = userID; //objBL.RTI_request_date = DateTime.Now.ToString("yyyy-MM-dd"); Utilities util = new Utilities(); objBL.RTI_ipaddress = util.GetClientIpAddress(this.Page);//GetIPAddress(); objBL.RTI_Is_bpl = DDL_BPL.SelectedItem.Value; # region check for BPL if (objBL.RTI_Is_bpl == "Y") { if (FU_BPL.PostedFile == null || FU_BPL.PostedFile.ContentLength < 1) { Utilities.MessageBox_UpdatePanel(update1, "Attach one BPL Supporting Document "); return; } objBL.BPL_Card_No = txtBPLNo.Text; int Current_year = Convert.ToInt32(DateTime.Now.Year); int find_year = Convert.ToInt32(txtYearOfIssue.Text); if (find_year > Current_year) { // Utilities.MessageBoxShow("Year should not be greater then current year"); Utilities.MessageBox_UpdatePanel(update1, "Year should not be greater then current year "); return; } else { objBL.BPL_Issue_Year = txtYearOfIssue.Text; } objBL.BPL_Issuing_Authority = txtIssuingAuthority.Text; //objBL.RTI_Fees = "0"; } else { //objBL.RTI_Fees = "10"; } #endregion BPL // set data for rti_filed_user // objBL.RTI_filed_user_id = objDl.GetMaxValueRtiFiledUser();//"<NTC>RTI Filed user ID from DL"; //objDl.GetMaxValue("SELECT IFNULL(MAX(rti_FiledUserID),0) as NO FROM rti_filed_user "); # region file submit problem is generating here objBL.RTI_filed_user_id = objBL.RTI_Request_id; objBL.Rti_Status = "REG"; //Initial status of RTI Filed objBL.Action_id = ""; objBL.IsValid = "N"; objBL.Office_mapping_id = DDL_RTI_Officer.SelectedValue; objBL.Action_date = DateTime.Now.ToString("yyyy-MM-dd"); // Need to ask //objBL.Rti_Status = "registered"; // initial status //set data for rti_file string RTI_fileID = objDl.GetMaxValueRtiFiles();// "<NTC> file iD";//objDl.GetMaxValue("SELECT IFNULL(MAX(rti_fileID),0) as NO FROM rti_files "); List <bl_RTI_RequestFiles> objList = new List <bl_RTI_RequestFiles>(); int maxCountFileID = Convert.ToInt32(RTI_fileID); if (FU_BPL.PostedFile != null && FU_BPL.PostedFile.FileName != "") { if (FU_BPL.PostedFile.ContentLength > 0) { bl_RTI_RequestFiles objBLFile = new bl_RTI_RequestFiles(); HttpPostedFile postedFile = FU_BPL.PostedFile; objBLFile.FileDescription = txt_FU_BPL_Disc.Text; objBLFile.RTI_fileID = maxCountFileID.ToString(); objBLFile.RTI_fileName = Path.GetFileName(postedFile.FileName); objBLFile.RTI_fileType = postedFile.ContentType; objBLFile.BPL_RTI_FileType = "BPL_DOC"; // it is a BPL Supporting Document objBLFile.RTI_Request_id = objBL.RTI_Request_id; Stream fs = postedFile.InputStream; if ((objBLFile.RTI_fileType == "application/pdf" || objBLFile.RTI_fileType == "application/x-pdf" || objBLFile.RTI_fileType == "application/x-unknown") && fs.Length < 2097152) { BinaryReader br = new BinaryReader(fs); byte[] bytes = br.ReadBytes((Int32)fs.Length); objBLFile.RTI_fileData = bytes; maxCountFileID = maxCountFileID + 1; objList.Add(objBLFile); // Add into the list } else { //statusCount = 1; // Utilities.MessageBoxShow("Only Image File and less then 1000 KB is accepted"); //lbl_status.Text = " Only Image File and less then 1000 KB is accepted "; Utilities.MessageBox_UpdatePanel(update1, " Only PDF File and less then 2000 KB is accepted for BPL File"); return; } } else { Utilities.MessageBox_UpdatePanel(update1, " BPL File Size Must be great then Zero"); return; } } // RTI File Insert in data base if (FU_RTI.PostedFile != null && FU_RTI.PostedFile.FileName != "") { if (FU_RTI.PostedFile.ContentLength > 0) { bl_RTI_RequestFiles objBLFile = new bl_RTI_RequestFiles(); HttpPostedFile postedFile = FU_RTI.PostedFile; objBLFile.FileDescription = txt_FU_RTI_Disc.Text; objBLFile.RTI_fileID = maxCountFileID.ToString(); objBLFile.RTI_fileName = Path.GetFileName(postedFile.FileName); objBLFile.RTI_fileType = postedFile.ContentType; objBLFile.BPL_RTI_FileType = "RTI_DOC"; // it is RTI Document objBLFile.RTI_Request_id = objBL.RTI_Request_id; Stream fs = postedFile.InputStream; if ((objBLFile.RTI_fileType == "application/pdf" || objBLFile.RTI_fileType == "application/x-pdf" || objBLFile.RTI_fileType == "application/x-unknown") && fs.Length < 2097152) { BinaryReader br = new BinaryReader(fs); byte[] bytes = br.ReadBytes((Int32)fs.Length); objBLFile.RTI_fileData = bytes; maxCountFileID = maxCountFileID + 1; objList.Add(objBLFile); // Add into the list } else { //statusCount = 1; // Utilities.MessageBoxShow("Only Image File and less then 1000 KB is accepted"); //lbl_status.Text = " Only Image File and less then 1000 KB is accepted "; Utilities.MessageBox_UpdatePanel(update1, " Only PDF File and less then 2000 KB is accepted for RTI File"); return; } } else { Utilities.MessageBox_UpdatePanel(update1, "RTI File Size Must be greater then Zero"); return; } objBL.IsRTIFileUpload = "Y"; } #endregion if (objBL.Mobile == H_LoginMobileNo.Value) { objBL.IsValid = "Y"; } ReturnClass.ReturnBool dt = objDl.Insert_RTI_Info(objBL, objList); if (dt.status == true) { if (objBL.Mobile == H_LoginMobileNo.Value) { // Directly go to success page No Need OTP string rti_message = "RTI Submition successfull your Registration no. is: " + objBL.RTI_Request_id + " And Your Security Code is: " + objBL.Securitycode + " please save details for further Information."; Utilities.MessageBox_UpdatePanel_Redirect(update1, rti_message, "./UserWelcome.aspx"); } else { Session["RTI_ID"] = objBL.RTI_Request_id; Session["VERIFICATION_TYPE"] = "Rti"; Utilities.MessageBox_UpdatePanel_Redirect(update1, "Your RTI Request has been submited Need Mobile Verification for Registeration", "./User_Mobile_Varification.aspx"); } } else { Utilities.MessageBox_UpdatePanel(update1, "RTI Submition Failed"); } }//end of captcha1 validated else { Utilities.MessageBox_UpdatePanel(update1, "Incorrect Security Code"); } } // If ! captch expired } // End of If checkRefresh
} // pageLoad End protected void btn_submit_Click(object sender, EventArgs e) { bl_employee_action bl1 = new bl_employee_action(); dl_employee_action dl1 = new dl_employee_action(); if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); HttpBrowserCapabilities browse = Request.Browser; bl.RegistrationID = h_RTI_ID.Value; rd = dl.Select_rti_action_detail(bl); if (rd.table.Rows.Count > 0) { bl1.Rti_id = h_RTI_ID.Value; bl1.Userid = Session["username"].ToString(); bl1.Dept_Status = "NREV"; bl1.Action_id = dl1.max_action_id(bl1); bl1.Office_mapping_id = rd.table.Rows[0]["officer_mapping_id"].ToString(); bl1.Ipaddress = ul.GetClientIpAddress(this.Page); bl1.Useragent = Request.UserAgent.ToString(); bl1.Useros = Utilities.System_Info(this.Page); bl1.User_browser = browse.Browser; bl1.Isnew = "Y"; // string dtstring = rd.table.Rows[0]["action_date"].ToString(); // DateTime dt = DateTime.ParseExact(dtstring, "dd/MM/yyyy HH:mm:ss", null); string dt1 = DateTime.Now.ToString("yyyy/MM/dd"); bl1.Action_date = dt1;//dt.ToString("yyyy/MM/dd"); bl1.Action_discription = rd.table.Rows[0]["action_detail"].ToString() + " :CLARIFICATION: " + txt_RequestApplicationText.Text; bl1.Is_file_upload = "N"; bl1.Rti_status = "PEN"; bl1.R_office_map_id = bl1.Office_mapping_id; } else { // No action record found } rb = dl1.Insert_Clarification_Action(bl1); if (rb.status == true) { if (Session["language"].ToString() == "en-GB") { Utilities.MessageBoxShow_Redirect("Action Submitted Successfully", "../user/UserDashBoard.aspx"); } else { Utilities.MessageBoxShow_Redirect("कार्रवाई सफलतापूर्वक सबमिट की गई", "../user/UserDashBoard.aspx"); } } else { if (Session["language"].ToString() == "en-GB") { Utilities.MessageBoxShow("Action Not Submitted"); } else { Utilities.MessageBoxShow("कार्रवाई सबमिट नहीं की गई"); } } } }
// protected internal override void Render(HtmlTextWriter markupWriter) { WmlTextWriter writer = (WmlTextWriter)markupWriter; String text, url, phoneNumber; String controlText = Control.Text; // Always strip off optional separators for PhoneNumber before it // is added in markup. String originalNumber = Control.PhoneNumber; char[] plainNumber = new char[originalNumber.Length]; // allocate enough buffer size // Loop to strip out optional separators int sizeOfPlainNumber = 0; for (int i = 0; i < originalNumber.Length; ++i) { char ch = originalNumber[i]; if ((ch >= '0' && ch <= '9') || ch == '+') { plainNumber[sizeOfPlainNumber] = ch; sizeOfPlainNumber++; } } // Assign the number string with the right size phoneNumber = new String(plainNumber, 0, sizeOfPlainNumber); // Construct text and url based on device capabilities // HttpBrowserCapabilities browser = null; if (Page != null && Page.Request != null) { browser = Page.Request.Browser; } // if (browser != null && (String)browser["canInitiateVoiceCall"] != "true") { text = String.Format(controlText, originalNumber); url = Control.ResolveClientUrl(Control.NavigateUrl); url = Control.GetCountClickUrl(url); } else { // Some WML browsers require the phone number // showing as text so it can be selected. If it is not // formatted in the text yet, append it to the end of the // text. // if (browser != null && browser["requiresPhoneNumbersAsPlainText"] == "true") { text = controlText + " " + phoneNumber; url = String.Empty; } else { text = (!String.IsNullOrEmpty(controlText)) ? controlText : originalNumber; url = "wtai://wp/mc;" + phoneNumber; } } // Write out plain text or corresponding link/softkey command // accordingly // writer.EnterStyle(Control.ControlStyle); if (url.Length == 0) { writer.WriteEncodedText(text); } else { String softkeyLabel = Control.SoftkeyLabel; if (String.IsNullOrEmpty(softkeyLabel)) { softkeyLabel = text; } PageAdapter.RenderBeginHyperlink(writer, url, false /* encode, Whidbey 28731 */, softkeyLabel, Control.AccessKey); writer.Write(text); PageAdapter.RenderEndHyperlink(writer); } writer.ExitStyle(Control.ControlStyle); }
/// <summary> /// Show list of input /// </summary> /// <param name="inputPlace1"> div of clolumn 1 </param> /// <param name="inputPlace2"> div of clolumn 2 </param> /// <param name="inputParam"> list of Parameter Object </param> /// <param name="browser"> Detect Browser </param> static public void ShowInput(PlaceHolder inputPlace1, PlaceHolder inputPlace2, List <AMLParam> inputParam, HttpBrowserCapabilities browser) { inputPlace1.Controls.Add(new LiteralControl("<fieldset><legend>Global Parameters <!-- <span class=\"glyphicon glyphicon-triangle-bottom\" id=\"icon_expand_global\" style=\"float: right\"></span> --></legend><div id=\"globalArea\">")); if (inputParam == null || inputParam.Count == 0) { inputPlace1.Controls.Add(new LiteralControl("<h3>No web service input</h3>")); return; } int count = 0; for (int i = 0; i < inputParam.Count; i++) //MLParameter param in inputParam) { Literal lcssFormGroup = new Literal(); lcssFormGroup.Text = "<div class=\"form-group\">"; Literal ldiv = new Literal(); ldiv.Text = "</div>"; AMLParam param = inputParam[i]; Label lbl = new Label(); if (string.IsNullOrEmpty(param.Alias)) { lbl.Text = textInfo.ToTitleCase(param.Name); } else { lbl.Text = textInfo.ToTitleCase(param.Alias); } lbl.ID = "lbl" + param + count++; lbl.Attributes.Add("Class", "fieldname"); int numOfPlace1 = inputParam.Count / 2; if (inputPlace2 == null) { numOfPlace1 = inputParam.Count; } if (i <= numOfPlace1) { inputPlace1.Controls.Add(lcssFormGroup); inputPlace1.Controls.Add(lbl); foreach (var control in GenerateInputControl(param, browser)) { inputPlace1.Controls.Add(control); } if (!string.IsNullOrEmpty(param.Description)) { inputPlace1.Controls.Add(new LiteralControl(string.Format("<div style=\"width=:100%\"><samp>{0}</samp></div>", param.Description))); } inputPlace1.Controls.Add(ldiv); } else { inputPlace2.Controls.Add(lcssFormGroup); inputPlace2.Controls.Add(lbl); foreach (var control in GenerateInputControl(param, browser)) { inputPlace2.Controls.Add(control); } if (!string.IsNullOrEmpty(param.Description)) { inputPlace2.Controls.Add(new LiteralControl(string.Format("<div style=\"width=:100%\"><samp>{0}</samp></div>", param.Description))); } inputPlace2.Controls.Add(ldiv); } } inputPlace1.Controls.Add(new LiteralControl("</div></fieldset>")); }
public static void AddAttempt(LoginUser loginUser, int userID, bool success, string ipAddress, HttpBrowserCapabilities browser, string userAgent, string deviceID) { LoginAttempts loginAttempts = new LoginAttempts(loginUser); using (SqlCommand command = new SqlCommand()) { command.CommandText = @"INSERT INTO [LoginAttempts] ([UserID] ,[Successful] ,[IPAddress] ,[Browser] ,[Version] ,[MajorVersion] ,[CookiesEnabled] ,[Platform] ,[UserAgent] ,[DateCreated] ,[DeviceID]) VALUES (@UserID ,@Success ,@IPAddress ,@Browser ,@Version ,@MajorVersion ,@Cookies ,@Platform ,@UserAgent ,GETUTCDATE() ,@DeviceID)"; command.CommandType = CommandType.Text; command.Parameters.AddWithValue("@UserID", userID); command.Parameters.AddWithValue("@Success", success); command.Parameters.AddWithValue("@IPAddress", ipAddress); command.Parameters.AddWithValue("@Browser", DataUtils.GetBrowserName(userAgent)); command.Parameters.AddWithValue("@Version", browser.Version); command.Parameters.AddWithValue("@MajorVersion", browser.MajorVersion.ToString()); command.Parameters.AddWithValue("@Cookies", browser.Cookies); command.Parameters.AddWithValue("@Platform", browser.Platform); command.Parameters.AddWithValue("@UserAgent", userAgent); command.Parameters.AddWithValue("@DeviceID", deviceID); loginAttempts.ExecuteNonQuery(command, "LoginAttempts"); } }
private static BrowserType GetBrowserType() { HttpBrowserCapabilities client = HttpContext.Current.Request.Browser; return(_userAgentParser.Parse(client)); }
// CodeGenerator will override this function to declare custom browser capabilities public virtual void ConfigureCustomCapabilities(NameValueCollection headers, HttpBrowserCapabilities browserCaps) { }
/// <summary> /// Checks the properties of the HttpBrowserCapabilities instance passed /// into the method for the property name contained in the property parameters /// string value. /// </summary> /// <param name="property">Property name to be found.</param> /// <param name="capabilities">Capabilities collection to be used.</param> /// <returns>If the property exists then return the associated value, otherwise null.</returns> private static string GetHttpBrowserCapabilitiesPropertyValue(string property, HttpBrowserCapabilities capabilities) { Type controlType = capabilities.GetType(); System.Reflection.PropertyInfo propertyInfo = controlType.GetProperty(property); if (propertyInfo != null && propertyInfo.CanRead) { return(propertyInfo.GetValue(capabilities, null).ToString()); } // Try browser capabilities next. string value = capabilities[property]; if (value != null) { return(value); } return(null); }
public RegexWorker(HttpBrowserCapabilities browserCaps) { this._browserCaps = browserCaps; }
public MobileBrowserCapabilities(HttpBrowserCapabilities browserCaps) : this() { _IsMobileDevice = false; if (browserCaps != null) { if (browserCaps.Adapters != null && browserCaps.Adapters.Count > 0) { foreach (object key in browserCaps.Adapters.Keys) { try { if (Adapters.Contains(key)) { Adapters[key] = browserCaps.Adapters[key]; } else { Adapters.Add(key, browserCaps.Adapters[key]); } } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data); } } } if (browserCaps.Adapters != null) { SharePresenceAdapters(Adapters); } if (browserCaps.Capabilities != null && browserCaps.Capabilities.Count > 0) { foreach (object key in browserCaps.Capabilities.Keys) { try { if (Capabilities.Contains(key)) { Capabilities[key] = browserCaps.Capabilities[key]; } else { Capabilities.Add(key, browserCaps.Capabilities[key]); } } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data); } } } try { //Capabilities = browserCaps.Capabilities; HtmlTextWriter = browserCaps.HtmlTextWriter; } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data); //ex.ToString(); } } }
/// <summary> /// Determines whether this is the specified browser and any of the specified major versions. /// </summary> public static bool IsBrowser(this HttpBrowserCapabilities browser, string browserName, params int[] majorVersions) { return(browser.IsBrowser(browserName) && majorVersions.Contains(browser.MajorVersion)); }
private void HandleRequest(HttpContext context, JsonRequest request, ref JsonResponse response) { context.Response.Clear(); HttpBrowserCapabilities browser = context.Request.Browser; // this is a specific fix for Opera 8.x // Opera 8 requires "text/plain" or "text/html" // otherwise the content encoding is mangled bool isOpera8 = browser.IsBrowser("opera") && (browser.MajorVersion <= 8); context.Response.ContentType = (isOpera8) ? MediaTypeNames.Text.Plain : JsonWriter.JsonMimeType; context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.AddHeader("Content-Disposition", "inline;filename=JsonResponse" + JsonServiceHandler.JsonFileExtension); response.ID = request.ID; System.Reflection.MethodInfo method = this.ServiceInfo.ResolveMethodName(request.Method); if (JsonServiceHandler.DescriptionMethodName.Equals(request.Method, StringComparison.Ordinal)) { response.Result = new JsonServiceDescription(this.ServiceInfo.ServiceType, this.serviceUrl); } else if (method != null) { Object[] positionalParams = null; if (request.NamedParams != null) { String[] paramMap = this.ServiceInfo.GetMethodParams(method.Name); positionalParams = new Object[paramMap.Length]; for (int i = 0; i < paramMap.Length; i++) { // initially map name to position positionalParams[i] = request.NamedParams[paramMap[i]]; if (positionalParams[i] == null) { // try to get as named positional param positionalParams[i] = request.NamedParams[i.ToString()]; } } } else if (request.PositionalParams != null) { positionalParams = new object[request.PositionalParams.Length]; request.PositionalParams.CopyTo(positionalParams, 0); } try { if (positionalParams != null) { ParameterInfo[] paramInfo = method.GetParameters(); for (int i = 0; i < positionalParams.Length; i++) { // ensure type compatibility of parameters positionalParams[i] = JsonReader.CoerceType(paramInfo[i].ParameterType, positionalParams[i]); } } response.Result = method.Invoke(this.Service, positionalParams); } catch (TargetParameterCountException ex) { throw new InvalidParamsException( String.Format( "Method \"{0}\" expects {1} parameters, {2} provided", method.Name, method.GetParameters().Length, positionalParams.Length), ex); } catch (TargetInvocationException ex) { throw new JsonServiceException((ex.InnerException ?? ex).Message, ex.InnerException ?? ex); } catch (Exception ex) { throw new JsonServiceException(ex.Message, ex); } } else { throw new InvalidMethodException("Invalid method name: " + request.Method); } }
public RegexWorker(HttpBrowserCapabilities browserCaps) { }
public ClientUtility() { browser = HttpContext.Current.Request.Browser; }
public static string GetBrowser() { HttpBrowserCapabilities bc = HttpContext.Current.Request.Browser; return(bc.Browser + " " + bc.Version); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); HttpBrowserCapabilities browse = Request.Browser; if (Page.IsValid) { //if (btnSubmit.Text == "Submit") // { string empCode = ddl_employee1.SelectedValue; //"201500001";// TBD bl.Office_mapping_id = dl.GetMappingID(empCode); //dl.GetMaxValue(); bl.Emp_code = empCode; bl.Office_id = ddl_office.SelectedValue; bl.Designation_id = ddl_designation.SelectedValue; bl.Base_department_id = ddl_department.SelectedValue; bl.Office_level_id = ddl_office_level.SelectedValue; bl.District_id_ofc = ddl_district.SelectedValue; bl.Office_category = ddl_office_category.SelectedValue; bl.User_id = Session["username"].ToString(); bl.Charge_type = ddl_charge.SelectedValue; bl.Active = ddl_Active.SelectedValue; bl.Role_id = Ddl_role.SelectedValue; if (bl.Active == "Y") { bl.FromActive = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") bl.ToActive = null; } else { bl.FromActive = DateTime.Now.ToString("yyyy-MM-dd"); bl.ToActive = DateTime.Now.ToString("yyyy-MM-dd"); } bl.ClientOS = Utilities.System_Info(this.Page); bl.ClientBrowser = browse.Browser; bl.Useragent = Request.UserAgent.ToString(); bl.Client_ip = ul.GetClientIpAddress(this); // GetIPAddress(); foreach (ListItem sin in ddlcb_permission.Items) { if (sin.Selected) { bl.Permission.Add(sin.Value); } } rb = dl.Insert_empOfficeMap(bl); if (rb.status == true) { if (Session["language"].ToString() == "en-GB") { Utilities.MessageBox_UpdatePanel(UpdatePanel1, "Employee Mapping Successsful"); } else { Utilities.MessageBox_UpdatePanel(UpdatePanel1, "कर्मचारी मैपिंग सफल"); } // Utilities.MessageBox_UpdatePanel(UpdatePanel1, "Employee Mapping Successsful"); clear(); bind_GridView(); } else { if (Session["language"].ToString() == "en-GB") { Utilities.MessageBox_UpdatePanel(UpdatePanel1, "Employee Mapping Failed"); } else { Utilities.MessageBox_UpdatePanel(UpdatePanel1, "कर्मचारी मैपिंग असफल"); } // Utilities.MessageBox_UpdatePanel(UpdatePanel1, "Employee Mapping Failed"); } // } // Submit } // if PageIsvalid } }
protected void Page_Load(object sender, EventArgs e) { comanyname.Text = CommonFiles.ComapnyName; hdnBversionM.Value = CommonFiles.MozillaVersion; hdnBversionC.Value = CommonFiles.ChromeVersion; HttpBrowserCapabilities objBrwInfo = Request.Browser; SqlDataReader dr; SqlCommand cmd = null; try { DataSet dsLocation = new DataSet(); String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); dsLocation = business.GetLocationDetailsByIp(strIp); if (dsLocation.Tables.Count > 0) { if (dsLocation.Tables[0].Rows.Count > 0) { int TimeZoneId = Convert.ToInt32(dsLocation.Tables[0].Rows[0]["TimeZoneId"].ToString()); Session["TimeZoneID"] = TimeZoneId; string timezone = ""; if (Convert.ToInt32(Session["TimeZoneID"]) == 2) { timezone = "Eastern Standard Time"; } else { timezone = "India Standard Time"; } DateTime ISTTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone)); var CurentDatetime = ISTTime; lblDate2.Text = CurentDatetime.ToString("dddd MMMM dd yyyy, hh:mm:ss tt "); lblDate.Text = CurentDatetime.TimeOfDay.TotalSeconds.ToString(); // lblTimeZoneName.Text = dsLocation.Tables[0].Rows[0]["TimeZoneName"].ToString(); Session["TimeZoneName"] = dsLocation.Tables[0].Rows[0]["TimeZoneName"].ToString(); lblTimeZoneName.Text = dsLocation.Tables[0].Rows[0]["TimeZoneName"].ToString(); lblLocation.Text = dsLocation.Tables[0].Rows[0]["LocationName"].ToString(); Session["LocationName"] = dsLocation.Tables[0].Rows[0]["LocationName"].ToString().Trim(); string LocationName = lblLocation.Text; DataSet dsImages = new DataSet(); dsImages = business.BindData(LocationName, CurentDatetime); Session["Employee"] = dsImages; rpEmp.DataSource = dsImages; rpEmp.DataBind(); DataSet dsImages1 = new DataSet(); dsImages1 = business.BindLogin(LocationName, CurentDatetime); Session["LoginEmployee"] = dsImages1; rpLogin.DataSource = dsImages1; rpLogin.DataBind(); DataSet dsImages2 = new DataSet(); dsImages2 = business.BindLogout(LocationName, CurentDatetime); rplogout.DataSource = dsImages2; rplogout.DataBind(); } else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "stopLoading();", true); } } else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "stopLoading();", true); } } catch (Exception ex) { } }
protected void login_click(object sender, EventArgs e) { try { vdm = new SalesDBManager(); string userid = Usernme_txt.Text, password = Pass_pas.Text; cmd = new SqlCommand("SELECT branchmaster.gstin, branchmaster.branchledgername, branchmapping.mainbranch, employe_details.sno, employe_details.loginflag, employe_details.employename, employe_details.userid, employe_details.password, employe_details.emailid, employe_details.phone, employe_details.branchtype, employe_details.leveltype, employe_details.departmentid, employe_details.branchid, branchmaster.branchid AS Expr1, branchmaster.branchname, branchmaster.address, branchmaster.branchcode, branchmaster.phone AS Expr2, branchmaster.tino, branchmaster.stno, branchmaster.cstno, branchmaster.emailid AS Expr3, branchmaster.statename FROM employe_details INNER JOIN branchmaster ON employe_details.branchid = branchmaster.branchid INNER JOIN departmentmaster ON departmentmaster.sno=employe_details.departmentid INNER JOIN branchmapping ON branchmaster.branchid=branchmapping.subbranch WHERE (employe_details.userid = @userid) AND (employe_details.password = @pwd)"); cmd.Parameters.Add("@pwd", password); cmd.Parameters.Add("@userid", userid); DataTable dt = vdm.SelectQuery(cmd).Tables[0]; if (dt.Rows.Count > 0) { string loginflag = dt.Rows[0]["loginflag"].ToString(); //if (loginflag == "False") //{ string sno = dt.Rows[0]["sno"].ToString(); cmd = new SqlCommand("update employe_details set loginflag=@log where sno=@sno"); cmd.Parameters.Add("@log", "1"); cmd.Parameters.Add("@sno", sno); vdm.Update(cmd); Session["TinNo"] = "37921042267"; Session["mainbranch"] = dt.Rows[0]["mainbranch"].ToString(); Session["Employ_Sno"] = dt.Rows[0]["sno"].ToString(); Session["Po_BranchID"] = dt.Rows[0]["branchid"].ToString(); Session["stateid"] = dt.Rows[0]["statename"].ToString(); Session["TitleName"] = "SRI VYSHNAVI DAIRY SPECIALITIES (P) LTD"; string julydt = "07/01/2017 12:00:00 AM"; DateTime gst_dt = Convert.ToDateTime(julydt); DateTime today = DateTime.Today; //if (today > gst_dt) //{ Session["Address"] = dt.Rows[0]["address"].ToString(); Session["gstin"] = dt.Rows[0]["gstin"].ToString(); //} //else //{ // Session["Address"] = "Survey No. 381-2, Punabaka Village, Pellakuru mandal SPSR Nellore (Dt) Pin - 524129, Andhra Pradesh,11. Email : [email protected] Phone: 7729995606; GSTIN NO: 37921042267."; // // Session["Address"] = "Survey No. 381-2, Punabaka Village, Pellakuru mandal SPSR Nellore (Dt) Pin - 524129.Couriering address : No.45, Madhu apartments,Panagal-517640,Srikalahasthi,Chittoor(dt),AndhraPradesh. Email : [email protected];[email protected] Phone: 7729995606,7729995603,9382525913; GSTIN: 37921042267."; //dt.Rows[0]["address"].ToString(); //} Session["BranchCode"] = dt.Rows[0]["branchcode"].ToString(); Session["TinNo"] = "37921042267"; Session["stno"] = dt.Rows[0]["stno"].ToString(); Session["cstno"] = dt.Rows[0]["cstno"].ToString(); Session["phone"] = dt.Rows[0]["phone"].ToString(); Session["emailid"] = dt.Rows[0]["emailid"].ToString(); Session["UserName"] = dt.Rows[0]["employename"].ToString(); Session["password"] = dt.Rows[0]["password"].ToString(); Session["BranchType"] = dt.Rows[0]["branchtype"].ToString(); Session["Department"] = dt.Rows[0]["departmentid"].ToString(); Session["leveltype"] = dt.Rows[0]["leveltype"].ToString(); Session["branchledgername"] = dt.Rows[0]["branchledgername"].ToString(); string branchtype = dt.Rows[0]["BranchType"].ToString(); string leveltype = dt.Rows[0]["leveltype"].ToString(); Response.Cookies["UserName"].Value = HttpUtility.UrlEncode("true"); Response.Cookies["UserName"].Path = "/"; Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(1); Response.Cookies["Employ_Sno"].Value = HttpUtility.UrlEncode("true"); Response.Cookies["Employ_Sno"].Path = "/"; Response.Cookies["Employ_Sno"].Expires = DateTime.Now.AddDays(1); //get ip address and device type string ipaddress; ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ipaddress == "" || ipaddress == null) { ipaddress = Request.ServerVariables["REMOTE_ADDR"]; } DateTime ServerDateCurrentdate = SalesDBManager.GetTime(vdm.conn); HttpBrowserCapabilities browser = Request.Browser; string devicetype = ""; string userAgent = Request.ServerVariables["HTTP_USER_AGENT"]; Regex OS = new Regex(@"(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino", RegexOptions.IgnoreCase | RegexOptions.Multiline); Regex device = new Regex(@"1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-", RegexOptions.IgnoreCase | RegexOptions.Multiline); string device_info = string.Empty; if (OS.IsMatch(userAgent)) { device_info = OS.Match(userAgent).Groups[0].Value; } if (device.IsMatch(userAgent.Substring(0, 4))) { device_info += device.Match(userAgent).Groups[0].Value; } if (!string.IsNullOrEmpty(device_info)) { devicetype = device_info; string[] words = devicetype.Split(')'); devicetype = words[0].ToString(); } else { devicetype = "Desktop"; } //string alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //string small_alphabets = "abcdefghijklmnopqrstuvwxyz"; //string numbers = "1234567890"; //string characters = numbers; //characters += alphabets + small_alphabets + numbers; //int length = 8; //string otp = string.Empty; //for (int i = 0; i < length; i++) //{ // string character = string.Empty; // do // { // int index = new Random().Next(0, characters.Length); // character = characters.ToCharArray()[index].ToString(); // } while (otp.IndexOf(character) != -1); // otp += character; //} cmd = new SqlCommand("INSERT INTO logininfo(userid, username, logintime, ipaddress, devicetype) values (@userid, @UserName, @logintime, @ipaddress, @device)"); cmd.Parameters.Add("@userid", dt.Rows[0]["sno"].ToString()); cmd.Parameters.Add("@UserName", Session["UserName"]); cmd.Parameters.Add("@logintime", ServerDateCurrentdate); cmd.Parameters.Add("@ipaddress", ipaddress); cmd.Parameters.Add("@device", devicetype); //cmd.Parameters.Add("@otp", otp); vdm.insert(cmd); // Session["leveltype"] = "Admin"; if (leveltype == "Admin ") { Response.Redirect("chartdashboard.aspx", false); } if (leveltype == "SuperAdmin") { Response.Redirect("chartdashboard.aspx", false); } if (leveltype == "User ") { Response.Redirect("InwardReport.aspx", false); } if (leveltype == "Operations") { Response.Redirect("PoDashBoard.aspx", false); } if (leveltype == "Issue ") { Response.Redirect("IssueDashBoard.aspx", false); } if (leveltype == "Receipt ") { Response.Redirect("InwardDashboard.aspx", false); } if (leveltype == "Section ") { Response.Redirect("IndentEntry.aspx", false); } //} //else //{ // lblMsg.Text = "Already Some one Login With This User Name"; //} } else { lblMsg.Text = "Invalid userId and Password"; } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
/// <summary> /// Creates a dictionary of capabilites for the requesting device based on both the /// current capabilities assigned by Microsoft, and the results from 51Degrees. /// </summary> /// <param name="results">The detection results.</param> /// <param name="currentCapabilities">The current capabilities assigned by .NET.</param> /// <returns>A dictionary of capabilities for the request.</returns> internal static IDictionary EnhancedCapabilities(SortedList <string, string[]> results, HttpBrowserCapabilities currentCapabilities) { // Use the base class to create the initial list of capabilities. IDictionary capabilities = new Hashtable(); // Add the capabilities for the device. EnhancedCapabilities(results, capabilities, currentCapabilities); // Initialise any capability values that rely on the settings // from the device data source. Init(capabilities); return(capabilities); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); this.EnsureChildControls(); if (HttpContext.Current.Error != null) { this.debugInformation = HttpContext.Current.Error.ToTraceString(); HttpContext.Current.ClearError(); } if (HttpContext.Current.Request.ServerVariables["X-ECP-ERROR"] != null) { HttpContext.Current.Response.AddHeader("X-ECP-ERROR", HttpContext.Current.Request.ServerVariables["X-ECP-ERROR"]); } string text = base.Request.QueryString["cause"] ?? "unexpected"; ErrorPageContents contentsForErrorType = ErrorPageContents.GetContentsForErrorType(text); string text2 = null; if (text == "browsernotsupported") { string helpId = EACHelpId.BrowserNotSupportedHelp.ToString(); IThemable themable = this.Page as IThemable; if (themable != null && themable.FeatureSet == FeatureSet.Options) { helpId = OptionsHelpId.OwaOptionsBrowserNotSupportedHelp.ToString(); } text2 = string.Format(contentsForErrorType.ErrorMessageText, HelpUtil.BuildEhcHref(helpId)); } else if (text == "nocookies") { HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser; if (browser != null && browser.IsBrowser("IE")) { text2 = string.Format(Strings.CookiesDisabledMessageForIE, HelpUtil.BuildEhcHref(EACHelpId.CookiesDisabledMessageForIE.ToString())); } } else if (text == "liveidmismatch") { string value = HttpContextExtensions.CurrentUserLiveID(); if (string.IsNullOrEmpty(value)) { contentsForErrorType = ErrorPageContents.GetContentsForErrorType("unexpected"); } else { string arg = EcpUrl.EcpVDir + "logoff.aspx?src=exch&ru=" + HttpUtility.UrlEncode(HttpContext.Current.GetRequestUrl().OriginalString); text2 = string.Format(contentsForErrorType.ErrorMessageText, HttpContextExtensions.CurrentUserLiveID(), arg); } } else if (text == "verificationfailed") { text2 = string.Format(contentsForErrorType.ErrorMessageText, EcpUrl.EcpVDir); } else if (text == "verificationprocessingerror") { text2 = contentsForErrorType.ErrorMessageText; } else if (text == "noroles") { this.ShowSignOutHint = true; this.ShowSignOutLink = true; this.SignOutReturnVdir = "/ecp/"; } else if (text == "cannotaccessoptionswithbeparamorcookie") { this.ShowSignOutLink = true; this.SignOutReturnVdir = "/owa/"; } if (string.IsNullOrEmpty(text2)) { this.msgText.Text = contentsForErrorType.ErrorMessageText; } else { this.msgText.Text = text2; } base.Title = contentsForErrorType.PageTitle; this.msgTitle.Text = Strings.ErrorTitle(contentsForErrorType.ErrorMessageTitle); this.msgCode.Text = ((int)contentsForErrorType.StatusCode).ToString(CultureInfo.InvariantCulture); HttpContext.Current.Response.StatusCode = (int)contentsForErrorType.StatusCode; HttpContext.Current.Response.SubStatusCode = contentsForErrorType.SubStatusCode; HttpContext.Current.Response.TrySkipIisCustomErrors = true; this.causeMarker.Text = "<!-- cause:" + contentsForErrorType.CauseMarker + " -->"; }
static IEnumerable <Control> GenerateInputControl(AMLParam param, HttpBrowserCapabilities browser) { if (param.StrEnum != null && param.StrEnum.Count > 3) // Drop list { yield return(GenerateDropdownList(param)); } else if (param.StrEnum != null && param.StrEnum.Count <= 3 && param.StrEnum.Count > 0) // Radio Button { yield return(new LiteralControl("<p>")); yield return(GenerateRadio(param)); yield return(new LiteralControl("</p>")); } else if (param.Type.ToLower() == "integer") // slider number Integer { TextBox txt = new TextBox(); txt.ID = param.Name; txt.Text = param.DefaultValue; txt.Attributes.Add("Class", "amount form-control form-control-number"); if (param.Type == "integer") { txt.TextMode = TextBoxMode.Number; } if (browser.Browser.ToLower() == "internetexplorer") { yield return(GenerateSliderHTML(param, "1")); yield return(txt); yield return(new LiteralControl("</div>")); // end of div yield return(GenerateScriptSlideIE(param)); } else { yield return(GenerateSliderHTML(param, "1")); yield return(txt); yield return(new LiteralControl("</div>")); // end of div yield return(GenerateScriptSlideHTML(param)); } } else if (param.Type.ToLower() == "number") // slider number Integer { TextBox txt = new TextBox(); txt.ID = param.Name; txt.Text = param.DefaultValue; txt.Attributes.Add("Class", "amount form-control form-control-number"); if (browser.Browser.ToLower() == "internetexplorer") { yield return(GenerateSliderHTML(param, "0.01")); yield return(txt); yield return(new LiteralControl("</div>")); // end of div yield return(GenerateScriptSlideIE(param)); } else { yield return(GenerateSliderHTML(param, "0.01")); yield return(txt); yield return(new LiteralControl("</div>")); // end of div yield return(GenerateScriptSlideHTML(param)); } } else { TextBox txt = new TextBox(); txt.ID = param.Name; txt.Text = param.DefaultValue; txt.Attributes.Add("Class", "form-control"); if (param.Format == "script") { txt.TextMode = TextBoxMode.MultiLine; } else if (param.Format == "password") { txt.TextMode = TextBoxMode.Password; } yield return(txt); } }
protected void btprocessa_Click(object sender, EventArgs e) { Boolean lOk = true; // HttpBrowserCapabilities bc = Request.Browser; if (lOk) { // lbbasegitano2.Text = bc.Type; // lbbasecep2.Text = bc.Browser; // lbusuariosativos2.Text = bc.Version; // lbclientesfinanciamentos2.Text = bc.MajorVersion.ToString(); // lbunidadescadastradas2.Text = bc.MinorVersion.ToString(); // lbvendas2.Text = bc.Platform; // lbcontasapagar2.Text = bc.Beta.ToString(); // lbcontasareceber2.Text = bc.Crawler.ToString(); // lbclientescreceber2.Text = bc.AOL.ToString(); // lbfornecedorescpagar2.Text = bc.Win16.ToString(); // lbcontascorrentes2.Text = bc.Win32.ToString(); // lbcorretores2.Text = bc.Frames.ToString(); // lblog2.Text = bc.Tables.ToString(); // lbfornecedores.Text = bc.Cookies.ToString(); // lbreceitas.Text = bc.VBScript.ToString(); // lbclientescontaareceber.Text = bc.JavaScript.ToString(); // lbbancos.Text = bc.JavaApplets.ToString(); // lbcontascorrentes3.Text = bc.ActiveXControls.ToString(); // lbsaldoinicial.Text = bc.CDF.ToString(); // } // //Processamento ScriptManager.RegisterStartupScript(UpdatePanel, GetType(), "msgbox", "alert('Processamento Concluído!');", true); if (lOk) { // CRIA LOG =============================================================================================================================================== SqlParameter[] param_log = { new SqlParameter("@login", (String)Session["CodUsuario"]), new SqlParameter("@tabela", "TODAS"), new SqlParameter("@operacao", "CONFIG"), new SqlParameter("@obs", "STATUS"), new SqlParameter("@acao", "STATUS DO BROWSER") }; uLog.MakeLog(param_log); // FIM CRIA LOG ============================================================================================================================================ } }
static HttpBrowserCapabilities GetHttpBrowserCapabilitiesFromBrowscapini(string ua) { HttpBrowserCapabilities bcap = new HttpBrowserCapabilities(); bcap.capabilities = CapabilitiesLoader.GetCapabilities (ua); return bcap; }
public void ProcessRequest(HttpContext context) { BusinessProxy proxy = new BusinessProxy(); int ImageWidth = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ImageWidth"]); int ImageHeight = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ImageHeight"]); int ThumbnailWidth = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ThumbnailWidth"]); int ThumbnailHeight = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ThumbnailHeight"]); string message = string.Format("SampleReportEditHandler Parameters from web config = ImageWidth: {0}, ImageHeight: {1}, ThumbnailWidth: {2}, ThumbnailHeight: {3}", ImageWidth.ToString(), ImageHeight.ToString(), ThumbnailWidth.ToString(), ThumbnailHeight.ToString()); Log.Info(message); int Id = Int32.Parse(HttpContext.Current.Request.Params["id"]); HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser; message = string.Format("SampleReportEditHandler Parameters = id: {0}, browser: {1}", Id, browser.Browser.ToLower()); Log.Info(message); if (browser.Browser.ToLower() == "ie") { message = string.Format("SampleReportEditHandler - browser: IE"); Log.Info(message); //This work for IE HttpPostedFile uploadedfile = context.Request.Files[0]; Stream inputStream = uploadedfile.InputStream; int read; // convert stream to array byte[] buffer = new byte[16 * 1024]; MemoryStream memoryStream = new MemoryStream(); while ((read = inputStream.Read(buffer, 0, buffer.Length)) > 0) { memoryStream.Write(buffer, 0, read); } byte[] PowerPointFile = memoryStream.ToArray(); // close streams inputStream.Close(); memoryStream.Close(); message = string.Format("SampleReportEditHandler IE Parameters = contentLength: {0}, contentType: {1}, fileName: {2}", uploadedfile.ContentLength, uploadedfile.ContentType, uploadedfile.FileName); Log.Info(message); // edit record string rtnVal = proxy.EditSampleReportUploadedFile(Id, PowerPointFile, ImageWidth, ImageHeight, ThumbnailWidth, ThumbnailHeight); message = string.Format("SampleReportEditHandler IE Return Value: {0}", rtnVal); Log.Info(message); // ajax - success context.Response.Write("{ \"success\": true }"); context.Response.End(); } else { message = string.Format("SampleReportEditHandler - browser: FF/Chrome file upload successful."); Log.Info(message); //This work for Firefox and Chrome. HttpPostedFile postedfile = HttpContext.Current.Request.Files.Get(0) as HttpPostedFile; Stream inputStream = postedfile.InputStream; message = string.Format("SampleReportEditHandler FF/Chrome Parameters = filename: {0}", postedfile.FileName); Log.Info(message); int read; // convert stream to array byte[] buffer = new byte[16 * 1024]; MemoryStream memoryStream = new MemoryStream(); while ((read = inputStream.Read(buffer, 0, buffer.Length)) > 0) { memoryStream.Write(buffer, 0, read); } byte[] PowerPointFile = memoryStream.ToArray(); // close streams inputStream.Close(); memoryStream.Close(); // edit record string rtnVal = proxy.EditSampleReportUploadedFile(Id, PowerPointFile, ImageWidth, ImageHeight, ThumbnailWidth, ThumbnailHeight); message = string.Format("SampleReportEditHandler FF/Chrome Return Value: {0}", rtnVal); Log.Info(message); // ajax - success context.Response.Write("{ \"success\": true }"); context.Response.End(); } }
/* * The actual initializer sets up Item[] before calling Init() */ internal void InitInternal(HttpBrowserCapabilities browserCaps) { if (_items != null) { throw new ArgumentException(SR.GetString(SR.Caps_cannot_be_inited_twice)); } _items = browserCaps._items; _adapters = browserCaps._adapters; _browsers = browserCaps._browsers; _htmlTextWriter = browserCaps._htmlTextWriter; _useOptimizedCacheKey = browserCaps._useOptimizedCacheKey; Init(); }
public bool IsSupported(HttpBrowserCapabilities browser) { return(true); }
internal HttpBrowserCapabilities GetHttpBrowserCapabilities(HttpRequest request) { if (request == null) throw new ArgumentNullException("request"); NameValueCollection headers = request.Headers; HttpBrowserCapabilities browserCaps = new HttpBrowserCapabilities(); Hashtable values = new Hashtable(180, StringComparer.OrdinalIgnoreCase); values[String.Empty] = HttpCapabilitiesDefaultProvider.GetUserAgent(request); browserCaps.Capabilities = values; ConfigureBrowserCapabilities(headers, browserCaps); ConfigureCustomCapabilities(headers, browserCaps); return browserCaps; }
public void Refresh() { //BrowserInfo if (_IsShowEnvironmentInfo) { DivBrowserArea.Visible = true; ltlEnvironment.Text = ""; ltlEnvironment.Text += " <Span class='Util_Legend'>IP Info</Span>"; ltlEnvironment.Text += "<ul>"; ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Server IPv4", Util.getServerIPv4(), _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Client IPv4", Util.getClientIPv4(), _txtColor, _valColor); ltlEnvironment.Text += "</ul>"; HttpBrowserCapabilities obj = Request.Browser; ltlEnvironment.Text += " <Span class='Util_Legend'>Browser Info</Span>"; ltlEnvironment.Text += "<ul>"; ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.Name", HttpUtility.HtmlEncode(obj.Browser), _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.Type", HttpUtility.HtmlEncode(obj.Type), _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.Version", HttpUtility.HtmlEncode(obj.Version), _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.MajorVersion", obj.MajorVersion, _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.MinorVersion", obj.MinorVersion, _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.Platform", HttpUtility.HtmlEncode(obj.Platform), _txtColor, _valColor); //ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Frames", obj.Frames, _txtColor, _valColor); //ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Tables", obj.Tables, _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.Cookies", obj.Cookies, _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Browser.EcmaScriptVersion", obj.EcmaScriptVersion, _txtColor, _valColor); //ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Java Applets", obj.JavaApplets, _txtColor, _valColor); //ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Beta", obj.Beta, _txtColor, _valColor); //ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Crawler", obj.Crawler, _txtColor, _valColor); //ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "AOL", obj.AOL, _txtColor, _valColor); //ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "CDF", obj.CDF, _txtColor, _valColor); ltlEnvironment.Text += "</ul>"; ltlEnvironment.Text += " <Span class='Util_Legend'>OS & Culture Info</Span>"; ltlEnvironment.Text += "<ul>"; ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Request.UserAgent", HttpUtility.HtmlEncode(Request.UserAgent), _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "Request.UserLanguages", HttpUtility.HtmlEncode(string.Join(",", Request.UserLanguages)), _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "CurrentThread.Culture", _Culture, _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "CurrentThread.Culture.Parent", _ParentCulture, _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "CurrentThread.UICulture", _UICulture, _txtColor, _valColor); ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", "CurrentThread.UICulture.Parent", _UIParentCulture, _txtColor, _valColor); ltlEnvironment.Text += "</ul>"; // AppSetting Info 2016.12.28 ltlEnvironment.Text += string.Format(" <Span class='Util_Legend'>AppSetting Info [{0}]</Span>", ConfigurationManager.AppSettings.Count); ltlEnvironment.Text += "<ul>"; if (ConfigurationManager.AppSettings.Count > 0) { for (int i = 0; i < ConfigurationManager.AppSettings.Count; i++) { ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", ConfigurationManager.AppSettings.Keys[i], ConfigurationManager.AppSettings[i], _txtColor, _valColor); } } ltlEnvironment.Text += "</ul>"; // Assembly Info 2016.07.26 Dictionary <string, string> dicAsm = Util.getAssemblyDictionary(); ltlEnvironment.Text += string.Format(" <Span class='Util_Legend'>Assembly Info [{0}]</Span>", (dicAsm != null) ? dicAsm.Count : 0); ltlEnvironment.Text += "<ul>"; if (dicAsm != null && dicAsm.Count > 0) { foreach (var pair in dicAsm) { ltlEnvironment.Text += string.Format("<li><font color='{2}'>{0} <font color='{3}'>[{1}]</font></font><br/>", pair.Key, pair.Value, _txtColor, _valColor); } } ltlEnvironment.Text += "</ul>"; } //QueryString if (_IsShowQueryString) { Dictionary <string, string> oDic = Util.getRequestQueryString(); DivQueryArea.Visible = true; labQueryString.Text = string.Format("Request.QueryString [{0}]", oDic.Count); ltlQueryString.Text = ""; foreach (var pair in oDic) { ltlQueryString.Text += string.Format("<li><font color='{2}'>{0} = <font color='{3}'>[{1}]</font></font><br/>", pair.Key, pair.Value, _txtColor, _valColor); } ltlQueryString.Text = string.Format("<ul>{0}</ul>", ltlQueryString.Text); } //RequestForm if (_IsShowRequestForm) { DivFormArea.Visible = true; labQueryForm.Text = string.Format("Request.Form [{0}]", Request.Form.Count); ltlQueryForm.Text = ""; for (int i = 0; i < Request.Form.Count; i++) { string tKey = Request.Form.Keys[i]; var tValue = Request.Form[i]; ltlQueryForm.Text += Util.getObjectInfo(tKey, tValue, _txtColor, _valColor, _objColor); } ltlQueryForm.Text = string.Format("<ul>{0}</ul>", ltlQueryForm.Text); } //Session if (_IsShowSession) { DivSessionArea.Visible = true; labSession.Text = string.Format("Session [{0}]", Session.Count); ltlSession.Text = ""; for (int i = 0; i < Session.Count; i++) { string tKey = Session.Keys[i]; var tValue = Session[i]; ltlSession.Text += Util.getObjectInfo(tKey, tValue, _txtColor, _valColor, _objColor); } ltlSession.Text = string.Format("<ul>{0}</ul>", ltlSession.Text); } //Application if (_IsShowApplication) { DivApplicationArea.Visible = true; labApplication.Text = string.Format("Application [{0}]", Application.Count); ltlApplication.Text = ""; for (int i = 0; i < Application.Count; i++) { string tKey = Application.Keys[i]; var tValue = Application[i]; ltlApplication.Text += Util.getObjectInfo(tKey, tValue, _txtColor, _valColor, _objColor); } ltlApplication.Text = string.Format("<ul>{0}</ul>", ltlApplication.Text); } }