find user identity - c#

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

Related

Launch Minecraft 1.8.3 with C#

I'm currently trying to make a minecraft launcher for my server. But some reason it wont start. This is the code I used. Can someone check what I did wrong ?
string installPath = GetJavaInstallationPath();
string filePath = System.IO.Path.Combine(installPath, "bin\\Javaw.exe");
Environment.SetEnvironmentVariable("APPDATA", "C:\\SCO\\");
Process process = new Process();
ProcessStartInfo info = new ProcessStartInfo();
string dir = #"C:\SCO\.minecraft\versions\";
info.FileName = filePath;
info.CreateNoWindow = true;
info.Arguments = "-cp \"" + dir + "1.8.3.jar;" + dir + "lwjgl.jar;" + dir + "lwjgl_util.jar;" + dir + "jinput.jar;\" ";
info.Arguments += "\"-Djava.library.path=" + dir + "natives\" -Xmx1024M -Xms512M net.minecraft.client.main.Main " + username + " " + session;
process.StartInfo = info;
process.Start();
try this code, it worked for me
private void StartMinecraft(string username, string accessToken, string uuid, string gameVersion)
{
ProcessStartInfo minecraft = new ProcessStartInfo
{
FileName = GetJavaInstallationPath() + #"\bin\javaw.exe",
CreateNoWindow = false,
Arguments = " -XX:+UseConcMarkSweepGC -XX:-UseAdaptiveSizePolicy -XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseCMSInitiatingOccupancyOnly -Xmx1024M -Dfile.encoding=UTF-8 -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Djava.library.path=C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/versions/" + gameVersion + "/natives -Dminecraft.launcher.brand=java-minecraft-launcher -Dminecraft.launcher.version=1.6.84-j -cp C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/com/ibm/icu/icu4j/66.1/icu4j-66.1.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/com/mojang/javabridge/1.0.22/javabridge-1.0.22.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/io/netty/netty-all/4.1.25.Final/netty-all-4.1.25.Final.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/com/google/guava/guava/21.0/guava-21.0.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/commons-io/commons-io/2.5/commons-io-2.5.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/commons-codec/commons-codec/1.10/commons-codec-1.10.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/com/mojang/brigadier/1.0.17/brigadier-1.0.17.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/com/mojang/datafixerupper/4.0.26/datafixerupper-4.0.26.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/it/unimi/dsi/fastutil/8.2.1/fastutil-8.2.1.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/apache/logging/log4j/log4j-api/2.8.1/log4j-api-2.8.1.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/apache/logging/log4j/log4j-core/2.8.1/log4j-core-2.8.1.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2/lwjgl-jemalloc-3.2.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/org/lwjgl/lwjgl-tinyfd/3.2.2/lwjgl-tinyfd-3.2.2.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/com/mojang/text2speech/1.11.3/text2speech-1.11.3.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/libraries/by/ely/authlib/2.0.27.4/authlib-2.0.27.4.jar;C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/versions/" + gameVersion + "/" + gameVersion + ".jar net.minecraft.client.main.Main --username " + username + " --version " + gameVersion + " --gameDir C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft --assetsDir C:/Users/" + Environment.UserName + "/AppData/Roaming/.minecraft/assets --assetIndex " + gameVersion + " --uuid " + uuid + " --accessToken " + accessToken + " --userType legacy --versionType release --width 925 --height 530"
};
Process.Start(minecraft);
}
Must try this: info.CreateNoWindow = true; to info.CreateNoWindow = false;
or recheck parameters and must be Java path is valid

Return on Large JSON String Crashing IIS Express in C#.NET Webpages

I am trying to query a database (SQL) for a large dataset (using JSON) so that I don't have to use AJAX more than once (round trips to the server are expensive, after all) to populate new data as the user interacts with the interface.
I am building the strings manually, while JSON.Encodeing and then trying to write it straight to the page so that my $.ajax jquery call can receive it on the other side.
Here's the jQuery
function getAllData(market) {
$.ajax({
url: "/AJAX Pages/Compute_Get_Vantrack_Data",
async: true,
type: "GET",
data: {
market: market
},
dataType: "json",
contentType: "application/json",
success: function (jsonResponse) {
jsonObj = jsonResponse;
alert(jsonObj.companies[2].ID + jsonObj.companies[2].companyName + jsonObj.companies[2].memo);
},
error: function (jqXHR, textStatus, error) {
alert("The request to the server has failed. The Vantrack information in your browser may not be populated accurately.\n\n" +
"Please reload the page and try again. If the problem persists, please contact an administrator.\n\n" +
"Error Type: " + error + "/" + textStatus + "/" + jqXHR)
}
});
}
Here's the C# (Compute_Get_Vantrack_Data)
#{
Layout = "";
if(!IsAjax)
{
var db = Database.Open("CST_DATA");
string getAllData = "SELECT * FROM Vantrack_";
string market = Request["market"];
string jsonString = "{\"companies\":[";
if (!String.IsNullOrWhiteSpace(market))
{
getAllData += market + " ORDER BY [company name] ASC";
foreach (var row in db.Query(getAllData))
{
jsonString += "{" +
"\"ID\":" + Json.Encode(row["ID"]) + "," +
"\"companyName\":" + Json.Encode(row["company name"]) + "," +
"\"companyAddress\":" + Json.Encode(row["company address"]) + "," +
"\"companyPoBox\":" + Json.Encode(row["company po box"]) + "," +
"\"companyCity\":" + Json.Encode(row["company city"]) + "," +
"\"companyState\":" + Json.Encode(row["company state"]) + "," +
"\"companyZip\":" + Json.Encode(row["company zip"]) + "," +
"\"companyPoZip\":" + Json.Encode(row["company po zip"]) + "," +
"\"companyCounty\":" + Json.Encode(row["company county"]) + "," +
"\"companyCountry\":" + Json.Encode(row["company country"]) + "," +
"\"companyPhone\":" + Json.Encode(row["company phone"]) + "," +
"\"company800\":" + Json.Encode(row["company 800"]) + "," +
"\"companyFax\":" + Json.Encode(row["company fax"]) + "," +
"\"companyWebsite\":" + Json.Encode(row["company website"]) + "," +
"\"companyFacilitySites\":" + Json.Encode(row["company facility sites"]) + "," +
"\"companyFacilityLocation01\":" + Json.Encode(row["company facility location 01"]) + "," +
"\"companyFacilityLocation02\":" + Json.Encode(row["company facility location 02"]) + "," +
"\"companyFacilityLocation03\":" + Json.Encode(row["company facility location 03"]) + "," +
"\"companyFacilityLocation04\":" + Json.Encode(row["company facility location 04"]) + "," +
"\"companyFacilityLocation05\":" + Json.Encode(row["company facility location 05"]) + "," +
"\"companyFacilityLocation06\":" + Json.Encode(row["company facility location 06"]) + "," +
"\"companyFacilityLocation07\":" + Json.Encode(row["company facility location 07"]) + "," +
"\"companyFacilityLocation08\":" + Json.Encode(row["company facility location 08"]) + "," +
"\"companyFacilityLocation09\":" + Json.Encode(row["company facility location 09"]) + "," +
"\"companyFacilityLocation10\":" + Json.Encode(row["company facility location 10"]) + "," +
"\"companyFacilityLocation11\":" + Json.Encode(row["company facility location 11"]) + "," +
"\"companyFacilityLocation12\":" + Json.Encode(row["company facility location 12"]) + "," +
"\"companyFacilityLocation13\":" + Json.Encode(row["company facility location 13"]) + "," +
"\"companyFacilityLocation14\":" + Json.Encode(row["company facility location 14"]) + "," +
"\"companyFacilityLocation15\":" + Json.Encode(row["company facility location 15"]) + "," +
"\"companyFacilityLocation16\":" + Json.Encode(row["company facility location 16"]) + "," +
"\"companyDrivingDirections\":" + Json.Encode(row["company driving directions"]) + "," +
"\"parentCorporationName\":" + Json.Encode(row["parent corporation name"]) + "," +
"\"corporateCompanyName\":" + Json.Encode(row["corporate company name"]) + "," +
"\"corporateCompanyAddress\":" + Json.Encode(row["corporate company address"]) + "," +
"\"corporateCompanyPoBox\":" + Json.Encode(row["corporate company po box"]) + "," +
"\"corporateCompanyCity\":" + Json.Encode(row["corporate company city"]) + "," +
"\"corporateCompanyState\":" + Json.Encode(row["corporate company state"]) + "," +
"\"corporateCompanyZip\":" + Json.Encode(row["corporate company zip"]) + "," +
"\"corporateCompanyPoZip\":" + Json.Encode(row["corporate company po zip"]) + "," +
"\"corporateCompanyCounty\":" + Json.Encode(row["corporate company county"]) + "," +
"\"corporateCompanyCountry\":" + Json.Encode(row["corporate company country"]) + "," +
"\"corporateCompanyPhone\":" + Json.Encode(row["corporate company phone"]) + "," +
"\"corporateCompany800\":" + Json.Encode(row["corporate company 800"]) + "," +
"\"corporateCompanyFax\":" + Json.Encode(row["corporate company fax"]) + "," +
"\"corporateCompanyWebsite\":" + Json.Encode(row["corporate company website"]) + "," +
"\"corporateFacilitySites\":" + Json.Encode(row["corporate facility sites"]) + "," +
"\"corporateFacilityLocations\":" + Json.Encode(row["corporate facility locations"]) + "," +
"\"clientStatusClient\":" + Json.Encode(row["client status client"]) + "," +
"\"clientStatusProspect\":" + Json.Encode(row["client status prospect"]) + "," +
"\"clientStatusFormer\":" + Json.Encode(row["client status former"]) + "," +
"\"targetMarket\":" + Json.Encode(row["target market"]) + "," +
"\"market\":" + Json.Encode(row["market"]) + "," +
"\"regSpecInitials\":" + Json.Encode(row["reg spec initials"]) + "," +
"\"contactName1\":" + Json.Encode(row["contact name 1"]) + "," +
"\"contactTitle1\":" + Json.Encode(row["contact title 1"]) + "," +
"\"contactAuthority1\":" + Json.Encode(row["contact authority 1"]) + "," +
"\"contactPhone1\":" + Json.Encode(row["contact phone 1"]) + "," +
"\"contactPhoneExt1\":" + Json.Encode(row["contact phone ext 1"]) + "," +
"\"contactCell1\":" + Json.Encode(row["contact cell 1"]) + "," +
"\"contactFax1\":" + Json.Encode(row["contact fax 1"]) + "," +
"\"contactEmail1\":" + Json.Encode(row["contact email 1"]) + "," +
"\"contactMassEmail1\":" + Json.Encode(row["contact mass email 1"]) + "," +
"\"contactVitalSigns1\":" + Json.Encode(row["contact vital signs 1"]) + "," +
"\"contactName2\":" + Json.Encode(row["contact name 2"]) + "," +
"\"contactTitle2\":" + Json.Encode(row["contact title 2"]) + "," +
"\"contactAuthority2\":" + Json.Encode(row["contact authority 2"]) + "," +
"\"contactPhone2\":" + Json.Encode(row["contact phone 2"]) + "," +
"\"contactPhoneExt2\":" + Json.Encode(row["contact phone ext 2"]) + "," +
"\"contactCell2\":" + Json.Encode(row["contact cell 2"]) + "," +
"\"contactFax2\":" + Json.Encode(row["contact fax 2"]) + "," +
"\"contactEmail2\":" + Json.Encode(row["contact email 2"]) + "," +
"\"contactMassEmail2\":" + Json.Encode(row["contact mass email 2"]) + "," +
"\"contactVitalSigns2\":" + Json.Encode(row["contact vital signs 2"]) + "," +
"\"contactName3\":" + Json.Encode(row["contact name 3"]) + "," +
"\"contactTitle3\":" + Json.Encode(row["contact title 3"]) + "," +
"\"contactAuthority3\":" + Json.Encode(row["contact authority 3"]) + "," +
"\"contactPhone3\":" + Json.Encode(row["contact phone 3"]) + "," +
"\"contactPhoneExt3\":" + Json.Encode(row["contact phone ext 3"]) + "," +
"\"contactCell3\":" + Json.Encode(row["contact cell 3"]) + "," +
"\"contactFax3\":" + Json.Encode(row["contact fax 3"]) + "," +
"\"contactEmail3\":" + Json.Encode(row["contact email 3"]) + "," +
"\"contactMassEmail3\":" + Json.Encode(row["contact mass email 3"]) + "," +
"\"contactVitalSigns3\":" + Json.Encode(row["contact vital signs 3"]) + "," +
"\"contactName4\":" + Json.Encode(row["contact name 4"]) + "," +
"\"contactTitle4\":" + Json.Encode(row["contact title 4"]) + "," +
"\"contactAuthority4\":" + Json.Encode(row["contact authority 4"]) + "," +
"\"contactPhone4\":" + Json.Encode(row["contact phone 4"]) + "," +
"\"contactPhoneExt4\":" + Json.Encode(row["contact phone ext 4"]) + "," +
"\"contactCell4\":" + Json.Encode(row["contact cell 4"]) + "," +
"\"contactFax4\":" + Json.Encode(row["contact fax 4"]) + "," +
"\"contactEmail4\":" + Json.Encode(row["contact email 4"]) + "," +
"\"contactMassEmail4\":" + Json.Encode(row["contact mass email 4"]) + "," +
"\"contactVitalSigns4\":" + Json.Encode(row["contact vital signs 4"]) + "," +
"\"corporateContactName1\":" + Json.Encode(row["corporate contact name 1"]) + "," +
"\"corporateContactTitle1\":" + Json.Encode(row["corporate contact title 1"]) + "," +
"\"corporateContactAuthority1\":" + Json.Encode(row["corporate contact authority 1"]) + "," +
"\"corporateContactPhone1\":" + Json.Encode(row["corporate contact phone 1"]) + "," +
"\"corporateContactPhoneExt1\":" + Json.Encode(row["corporate contact phone ext 1"]) + "," +
"\"corporateContactCell1\":" + Json.Encode(row["corporate contact cell 1"]) + "," +
"\"corporateContactFax1\":" + Json.Encode(row["corporate contact fax 1"]) + "," +
"\"corporateContactEmail1\":" + Json.Encode(row["corporate contact email 1"]) + "," +
"\"corporateContactMassEmail1\":" + Json.Encode(row["corporate contact mass email 1"]) + "," +
"\"corporateContactVitalSigns1\":" + Json.Encode(row["corporate contact vital signs 1"]) + "," +
"\"corporateContactName2\":" + Json.Encode(row["corporate contact name 2"]) + "," +
"\"corporateContactTitle2\":" + Json.Encode(row["corporate contact title 2"]) + "," +
"\"corporateContactAuthority2\":" + Json.Encode(row["corporate contact authority 2"]) + "," +
"\"corporateContactPhone2\":" + Json.Encode(row["corporate contact phone 2"]) + "," +
"\"corporateContactPhoneExt2\":" + Json.Encode(row["corporate contact phone ext 2"]) + "," +
"\"corporateContactCell2\":" + Json.Encode(row["corporate contact cell 2"]) + "," +
"\"corporateContactFax2\":" + Json.Encode(row["corporate contact fax 2"]) + "," +
"\"corporateContactEmail2\":" + Json.Encode(row["corporate contact email 2"]) + "," +
"\"corporateContactMassEmail2\":" + Json.Encode(row["corporate contact mass email 2"]) + "," +
"\"corporateContactVitalSigns2\":" + Json.Encode(row["corporate contact vital signs 2"]) + "," +
"\"sicCodes\":" + Json.Encode(row["sic codes"]) + "," +
"\"businessDescription\":" + Json.Encode(row["business description"]) + "," +
"\"numberOfEmployees\":" + Json.Encode(row["number of employees"]) + "," +
"\"naics\":" + Json.Encode(row["naics"]) + "," +
"\"msdsQuantity\":" + Json.Encode(row["msds quantity"]) + "," +
"\"chemicalsQuantity\":" + Json.Encode(row["chemicals quantity"]) + "," +
"\"rcraStatus\":" + Json.Encode(row["rcra status"]) + "," +
"\"yearEstablished\":" + Json.Encode(row["year established"]) + "," +
"\"annualSales\":" + Json.Encode(row["annual sales"]) + "," +
"\"fiscalYear\":" + Json.Encode(row["fiscal year"]) + "," +
"\"appointmentCallBack1\":" + Json.Encode(row["appointment call back 1"]) + "," +
"\"appointmentDate1\":" + Json.Encode(row["appointment date 1"]) + "," +
"\"appointmentTime1\":" + Json.Encode(row["appointment time 1"]) + "," +
"\"appointmentCallBack2\":" + Json.Encode(row["appointment call back 2"]) + "," +
"\"appointmentDate2\":" + Json.Encode(row["appointment date 2"]) + "," +
"\"appointmentTime2\":" + Json.Encode(row["appointment time 2"]) + "," +
"\"serviceActive1\":" + Json.Encode(row["service active 1"]) + "," +
"\"serviceMonths1\":" + Json.Encode(row["service months 1"]) + "," +
"\"serviceAmount1\":" + Json.Encode(row["service amount 1"]) + "," +
"\"serviceRcaNeeds1\":" + Json.Encode(row["service rca needs 1"]) + "," +
"\"serviceHotPercent1\":" + Json.Encode(row["service hot percent 1"]) + "," +
"\"serviceActive2\":" + Json.Encode(row["service active 2"]) + "," +
"\"serviceMonths2\":" + Json.Encode(row["service months 2"]) + "," +
"\"serviceAmount2\":" + Json.Encode(row["service amount 2"]) + "," +
"\"serviceRcaNeeds2\":" + Json.Encode(row["service rca needs 2"]) + "," +
"\"serviceHotPercent2\":" + Json.Encode(row["service hot percent 2"]) + "," +
"\"serviceActive3\":" + Json.Encode(row["service active 3"]) + "," +
"\"serviceMonths3\":" + Json.Encode(row["service months 3"]) + "," +
"\"serviceAmount3\":" + Json.Encode(row["service amount 3"]) + "," +
"\"serviceRcaNeeds3\":" + Json.Encode(row["service rca needs 3"]) + "," +
"\"serviceHotPercent3\":" + Json.Encode(row["service hot percent 3"]) + "," +
"\"serviceActive4\":" + Json.Encode(row["service active 4"]) + "," +
"\"serviceMonths4\":" + Json.Encode(row["service months 4"]) + "," +
"\"serviceAmount4\":" + Json.Encode(row["service amount 4"]) + "," +
"\"serviceRcaNeeds4\":" + Json.Encode(row["service rca needs 4"]) + "," +
"\"serviceHotPercent4\":" + Json.Encode(row["service hot percent 4"]) + "," +
"\"serviceActive5\":" + Json.Encode(row["service active 5"]) + "," +
"\"serviceMonths5\":" + Json.Encode(row["service months 5"]) + "," +
"\"serviceAmount5\":" + Json.Encode(row["service amount 5"]) + "," +
"\"serviceRcaNeeds5\":" + Json.Encode(row["service rca needs 5"]) + "," +
"\"serviceHotPercent5\":" + Json.Encode(row["service hot percent 5"]) + "," +
"\"serviceActive6\":" + Json.Encode(row["service active 6"]) + "," +
"\"serviceMonths6\":" + Json.Encode(row["service months 6"]) + "," +
"\"serviceAmount6\":" + Json.Encode(row["service amount 6"]) + "," +
"\"serviceRcaNeeds6\":" + Json.Encode(row["service rca needs 6"]) + "," +
"\"serviceHotPercent6\":" + Json.Encode(row["service hot percent 6"]) + "," +
"\"memo\": " + Json.Encode(row["memo"]) +
"},";
}
jsonString = jsonString.TrimEnd(',');
jsonString += "]}";
#* *##Html.Raw(jsonString);
}
else
{
#* *##:Incorrect data was sent. Please reload the page and try again. If the problem persists, please contact your database administrator.
}
}
else
{
#* *##:Generic Error! Not a proper AJAX request.
}
}
The problem I'm getting is that I keep getting this error (In Windows):
I'm not sure if this is an IIS-Express only problem, if the data set is too large, or if my use of JSON.Encode rather than some kind of other parsing method is causing this issue.
Things to Note
The Table I'm Querying has, not only 174 columns, but 6,468 rows, as well.
I tried to narrow down whether or not a single column was causing issues, and it starts to error around the contact phone 1 column, but that columns data type (nvarchar) is no different from so many others, and having a NULL value within it isn't different either.
Thinking this was a size issue, I decided to SELECT only the TOP (1) Rows, but grab all columns, and the error persists as though I'd selected all rows, and conversely, if I SELECT all rows, but comment out a group of columns (usually including, but not limited to the contact phone 1 column) I get a MUCH larger dataset returned with no problem.
I've repaired, compacted, and reconverted the old table twice, with no errors to make sure that it wasn't some quirky error from the migration from Access.
With just a little less than half of the columns, for all rows, queried, I used C# to write a simple text file (to test its size) and it was 12.5 MB, if that tells you anything about the size of the return I'm looking for here.
Is there a limit on the size of a json string that can be returned through an AJAX call? Is this a limit of IIS-Express (during live hosting, we'll actually be using IIS 8)? or am I doing something else completely wrong here?

Browser History -> Database

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

Collecting client computer and browser statistics

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

Creating an Infopath form that sends an email

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);

Categories

Resources