The net user command is a very useful tool. The instructions were confusing. when they say to type /domain, they mean it. not your domain or the users. the actual word domain.
The net user command is a very useful tool. The instructions were confusing. when they say to type /domain, they mean it. not your domain or the users. the actual word domain.
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet
The JQuery Calendar picker is a very handy element that is used in many places on the web. The default functionality is great, but what if you need a custom date range, or to black out specific dates? The picker has an event handler called “beforeShowDay” that will let you hook into and modify what dates are available to pick from the element.
For example, to allow users to sign up for campus visits on Tuesday and Thursday, I needed to “black out” the rest of the days from the ui. I also needed to black out a couple of days that will be unavailable due to special events. I can write a function to specify these days, then call the function on the “beforeShowDay” event handler.
[code]
var unavailableDates = [“19-5-2016”, “16-6-2016”];
function unavailable(date) {
dmy = date.getDate() + “-” + (date.getMonth()+1) + “-” +date.getFullYear();
if ($.inArray(dmy, unavailableDates) < 0) {
return [true,””,””];
} else {
return [false,””,”This day is unavailable.”];
}
var day = date.getDay();
return [(day == 2 || day==4)];
}
$( “#mydatefield” ).datepicker({
minDate: ‘+7d’, changeMonth: true, changeYear: true, yearRange:”c-80:c”, beforeShowDay: unavailable});
[/code]
If a variable comes from the sql database with a NULL value, its not the same as checking the c# variable for =”null” . You need a special line of code:
if (!DBNull.Value.Equals(MyDbVar))
Distance rate time: d=rt
Cost (selling price-cost=profit): p=s-c
simple interest (principal X rate): I=pr
mean(average) : x^n/n
To replace all existing classes with one or more new classes, set the className attribute:
document.getElementById("MyElement").className = "MyClass";
(You can use a space-delimited list to apply multiple classes.)
To add a class to an element, without removing/affecting existing values, append a space and the new classname, like so:
document.getElementById("MyElement").className += " MyClass";
To remove a single class to an element, without affecting other potential classes, a simple regex replace is required:
document.getElementById("MyElement").className =
document.getElementById("MyElement").className.replace
( /(?:^|\s)MyClass(?!\S)/g , '' )
/* code wrapped for readability - above is all one statement */
An explanation of this regex is as follows:
(?:^|\s) # match the start of the string, or any single whitespace character
MyClass # the literal text for the classname to remove
(?!\S) # negative lookahead to verify the above is the whole classname
# ensures there is no non-space character following
# (i.e. must be end of string or a space)
The g
flag tells the replace to repeat as required, in case the class name has been added multiple times.
The same regex used above for removing a class can also be used as a check as to whether a particular class exists:
if ( document.getElementById("MyElement").className.match(/(?:^|\s)MyClass(?!\S)/) )
Web.Config changes:
Inside system.web, after authorization:
<identity impersonate=”true” />
Inside system.webserver (add if needed outside of system.web):
<validation validateIntegratedModeConfiguration=”false” />
It’s helpful to be able to loop through the form object collection so you know what vars are being posted.
Here is an example from the MSDN docs.
This will display the form vars in a label object…
System.Text.StringBuilder displayValues =
new System.Text.StringBuilder();
System.Collections.Specialized.NameValueCollection
postedValues = Request.Form;
String nextKey;
for(int i = 0; i < postedValues.AllKeys.Length; i++)
{
nextKey = postedValues.AllKeys[i];
if(nextKey.Substring(0, 2) != “__”)
{
displayValues.Append(”
“);
displayValues.Append(nextKey);
displayValues.Append(” = “);
displayValues.Append(postedValues[i]);
}
}
Label1.Text = displayValues.ToString();