I want to fetch history from browser as soon as a web site is loaded in the browser. It should fetch clients' browser info and save it in a database so that admin may check out the website that is frequently opened and can do survey on the data.
System.Web.HttpBrowserCapabilities browser = Request.Browser;
string s = "Browser Capabilities\n"
+ "Type = " + browser.Type + "\n"
+ "Name = " + browser.Browser + "\n"
+ "Version = " + browser.Version + "\n"
+ "Major Version = " + browser.MajorVersion + "\n"
+ "Minor Version = " + browser.MinorVersion + "\n"
+ "Platform = " + browser.Platform + "\n"
+ "Is Beta = " + browser.Beta + "\n"
+ "Is Crawler = " + browser.Crawler + "\n"
+ "Is AOL = " + browser.AOL + "\n"
+ "Is Win16 = " + browser.Win16 + "\n"
+ "Is Win32 = " + browser.Win32 + "\n"
+ "Supports Frames = " + browser.Frames + "\n"
+ "Supports Tables = " + browser.Tables + "\n"
+ "Supports Cookies = " + browser.Cookies + "\n"
+ "Supports VBScript = " + browser.VBScript + "\n"
+ "Supports JavaScript = " +
browser.EcmaScriptVersion.ToString() + "\n"
+ "Supports Java Applets = " + browser.JavaApplets + "\n"
+ "Supports ActiveX Controls = " + browser.ActiveXControls
+ "\n";
Request.Browser is used to identify the browser info . Using this you can get all info of browser
IIS is already storing this information for you. See: http://msdn.microsoft.com/en-us/library/ms525410%28v=vs.90%29.aspx
To make that data useful you will then need to use a Log Analyzer tool.
Google this term for some options to use: iis log analyzer
Related
How can I show the Debug.Log in 2 lines (like adding an enter or <br>) in C#?
I have lots of info to show and compare, yet it is not convenient to read it in one line.
Current result: Debug.Log("Pointer:" + " " + pointerPosX + " " + pointerPosY + " " + "target" + " " + targetPosX + " " + targetPosY);
Expected result:
Pointer: pointerPosX + " " + pointerPosY
Target: targetPosX " " " + targetPosY
P.S. This is my first question in StackOverflow - so, please, let me know if I did something wrong.
Option 1 (\n):
Debug.Log("Pointer:" + " " + pointerPosX + " "
+ pointerPosY + "\n" + "Target:" + " " + targetPosX + " " + targetPosY);
Option 2 (System.Environment.NewLine):
Debug.Log("Pointer:" + " " + pointerPosX + " " + pointerPosY +
System.Environment.NewLine + "Target:" + " " + targetPosX + " " + targetPosY);
Using $ - string interpolation
Option 1:
Debug.Log($"Pointer: {pointerPosX} {pointerPosY}\nTarget: {targetPosX} {targetPosY}");
Option 2:
Debug.Log($"Pointer: {pointerPosX} {pointerPosY}{System.Environment.NewLine}Target: {targetPosX} {targetPosY}");
Difference between "\n" and Environment.NewLine
listBox2.Items.Add(c[n].nume_proprietar + ", " + c[n].nume_catel + ", " + c[n].varsta + " ani , " + c[n].data_vaccin + " " + c[n].tip_vaccin);
Hi, I was wandering if i could insert a line in between " ani , " and c[n].data_vaccin so that my code will display on 2 different lines, obviously with the vallues i insert when i will run the program:
c[n].nume_proprietar ", " c[n].nume_catel ", " c[n].varsta + " ani , " and on another line
c[n].data_vaccin " " c[n].tip_vaccin
Insert Environment.NewLine where you want to breakline. It is environment specific and provides clarity over "\r\n" hence it's preferred to use.
listBox2.Items.Add(c[n].nume_proprietar + ", " + c[n].nume_catel + ", " + c[n].varsta + " ani ," + Environment.NewLine + c[n].data_vaccin + " " + c[n].tip_vaccin);
We have a web application in which user can upload files to our server. We need to find the following details of clients so that we could know our user base
Operating System with version
Browser with version
Have a look at HttpRequest.Browser to get the browser identifier. For information about the operation system, refer to this SO post.
An example from the above link:
HttpBrowserCapabilities bc = Request.Browser;
Response.Write("<p>Browser Capabilities:</p>");
Response.Write("Type = " + bc.Type + "<br>");
Response.Write("Name = " + bc.Browser + "<br>");
Response.Write("Version = " + bc.Version + "<br>");
Response.Write("Major Version = " + bc.MajorVersion + "<br>");
Response.Write("Minor Version = " + bc.MinorVersion + "<br>");
Response.Write("Platform = " + bc.Platform + "<br>");
Response.Write("Is Beta = " + bc.Beta + "<br>");
Response.Write("Is Crawler = " + bc.Crawler + "<br>");
Response.Write("Is AOL = " + bc.AOL + "<br>");
Response.Write("Is Win16 = " + bc.Win16 + "<br>");
Response.Write("Is Win32 = " + bc.Win32 + "<br>");
Response.Write("Supports Frames = " + bc.Frames + "<br>");
Response.Write("Supports Tables = " + bc.Tables + "<br>");
Response.Write("Supports Cookies = " + bc.Cookies + "<br>");
Response.Write("Supports VB Script = " + bc.VBScript + "<br>");
Response.Write("Supports JavaScript = " + bc.JavaScript + "<br>");
Response.Write("Supports Java Applets = " + bc.JavaApplets + "<br>");
Response.Write("Supports ActiveX Controls = " + bc.ActiveXControls + "<br>");
Response.Write("CDF = " + bc.CDF + "<br>");
For operating system, try:
Request.Browser.Platform
For browser with version, try:
Request.UserAgent
To see what the User Agent corresponds to (if you're unsure), here's a reference http://www.user-agents.org/index.shtml?moz
Check for
Request.Browser property
Is it possible to detect user identity from browser using asp.net/vb.net/c# except IP address. My aim is to detect user visit count regardless of IP address; may be Mac address or etc?
Thanks
You can get more than just user identity from request object
HttpContext context = HttpContext.Current;
string browserInfo =
"RemoteUser=" + context.Request.ServerVariables["REMOTE_USER"] + ";\n"
+ "RemoteHost=" + context.Request.ServerVariables["REMOTE_HOST"] + ";\n"
+ "Type=" + context.Request.Browser.Type + ";\n"
+ "Name=" + context.Request.Browser.Browser + ";\n"
+ "Version=" + context.Request.Browser.Version + ";\n"
+ "MajorVersion=" + context.Request.Browser.MajorVersion + ";\n"
+ "MinorVersion=" + context.Request.Browser.MinorVersion + ";\n"
+ "Platform=" + context.Request.Browser.Platform + ";\n"
+ "SupportsCookies=" + context.Request.Browser.Cookies + ";\n"
+ "SupportsJavaScript=" + context.Request.Browser.EcmaScriptVersion.ToString() + ";\n"
+ "SupportsActiveXControls=" + context.Request.Browser.ActiveXControls + ";\n"
+ "SupportsJavaScriptVersion=" + context.Request.Browser["JavaScriptVersion"] + "\n";
You can access user identity by:
context.Request.ServerVariables["REMOTE_USER"]
or
User.Identity.Name
I am trying to include the text written by enduser in a textfield in an InfopathForm (textfield,multiline,paragraphbreaks and scroll bar if necessary) in an email to the relevant Department.
I always get this error "The name 'remarkmain' does not exist in the current context"
these are some parts of the code i used to define and include in mail:
string remarkmain = xnMyForm.SelectSingleNode("/my:myFields/my:field104", ns).Value;
string BodyAcc = "New Internal Employee " + Titlee + " " + fullname + ".\n Employee is joining " + Comp + " as of " + HireDate + ".\n\n Please view the general information below:\n " + bodyHD + "\n" + bodyED + "\n" + bodyDOB + "\n" + bodytitle + "\n" + bodylast + "\n" + bodyname + "\n" + bodyLang + "\n" + bodyComp + "\n" + bodydep + "\n" + bodyPos + "\n" + Bankacc + "\n" + add + "\n" + CostCtreVZW + "\n" + CostCtreCVBA + "\n\nWork Schedule\n" + WorkMon + "\n" + WorkTue + "\n" + WorkWed + "\n" + WorkThurs + "\n" + WorkFri + "\n" + WorkFDSch + "\n\n" + ContractN + "\n" + EmpN + "\n" + MGR + "\n" + Teamlead +"\n\n" **+ remarkmain** + "\n\n";
I am new to c# and this form i m creating in Infopath ( 2007 )
Have you considered submitting certain values to a form library and using sharepoint workflows via sharepoint designer to send the mail? The sharepoint workflow variable selection and general interface is generally expansive and pleasant and the functionality is extensive.
See to that strign BodyAcc="New Internal Employee+....remarkmain+....; is in remarkmain scope
Use StringBuilder if you have too many string concatinations
StringBuilder BodyAcc = new StringBuilder
BodyAcc.Append(New Internal Employee);
BodyAcc.Append("\n");
BodyAcc.Append(remarkmain);