Monthly Archives: December 2011

ASP.NET–prevent button from form submit based on condition in javascript

Here is a javascript function that retutns true or false based on wheather a listbox is empty (select element in html does not have any option elements)

function WarnIfCleanersListboxEmpty() {
    if ($('#lboxCleaners').children().length == 0) {
        alert('list is empty');
        return false;
    } 
    return true;
}

in ASP.NET page there is a button that submits the form

 <asp:Button ID="btnGenerate" runat="server" Text="Generuj" OnClientClick="return WarnIfCleanersListboxEmpty()"/>

it’s the return in OnClientClick that I always forget and then wander why the form gets submitted even if my javascript function evaluates to false.

WRONG: OnClientClick=”WarnIfCleanersListboxEmpty()”

RIGHT: OnClientClick=”return WarnIfCleanersListboxEmpty()”

Proxycfg.exe

proxycfg

This command displays the current WinHTTP proxy settings.

proxycfg -d

This command specifies that all HTTP and HTTPS servers should be accessed directly. Use this command if there is no proxy server.

proxycfg -p proxy-server-list optional-bypass-list

This command specifies one or more proxy servers, and an optional list of hosts that should be accessed directly. If a proxy server is not specified for a given protocol and that server is not in the bypass list, the -p option specifies that the server cannot be accessed at all.

proxycfg -d -p proxy-server-list optional-bypass-list

This command specifies one or more proxy servers, and an optional list of hosts that should be accessed directly. If a proxy server is not specified for the given protocol, the -d option specifies that the server should be accessed directly instead.

proxycfg -u

This command imports the Internet Explorer proxy settings of the current user. WinHTTP does not support auto-discovery and configuration script-based proxy settings.

Examples

The following is the most common command used with the proxycfg.exe utility. This command specifies to use the proxy server named “itgproxy” to access both HTTP and HTTPS servers, and also bypass any host names that do not contain a period. In this case, the -d option has no effect.

proxycfg -d -p itgproxy "<local>"

Compare the previous command to the following command which specifies to use the server named “itgproxy” to access both HTTP and HTTPS servers, and not to bypass any servers.

proxycfg -p itgproxy

The following is an example of a more complex command used by the proxycfg.exe utility. This command specifies to use the server named “http_proxy” to access HTTP servers and the server named “https_proxy” to access HTTPS servers. This command also specifies that local intranet sites (for example, host names that do not contain a period) and any site in the “*.microsoft.com” domain bypass the proxy.

proxycfg -p "http=http_proxy https=https_proxy" "<local>;*.microsoft.com"

Source:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms761351(v=vs.85).aspx

proxycfg.exe on Windows 7 – not any more! Netsh instead

view current configuration:
NETSH WinHTTP show proxy

set proxy:
NETSH WinHTTP Set Proxy proxy-server=”PROXY.COM:8080″ bypass-list=”SERVER.COM”

A Few of My Favorite HTML5 and CSS3 Online Tools – Dan Wahlins WebLog

A Few of My Favorite HTML5 and CSS3 Online Tools – Dan Wahlins WebLog.

Scott Hanselman’s 2011 Ultimate Developer and Power Users Tool List for Windows – Scott Hanselman

Scott Hanselman's 2011 Ultimate Developer and Power Users Tool List for Windows – Scott Hanselman.

smsagent

Tips, tricks and time-savers for the Windows and ConfigMgr administrator

To The Point

Anything about Technology and Business

Brian's Power Windows Blog

Microsoft in the Enterprise. Windows, Hyper-V, Exchange, SQL, and more!

PowerScripting Podcast

Shownotes and links for the PowerScripting Podcast, a podcast to help people learn Windows Powershell

Learn Powershell | Achieve More

What is this Powershell of which you speak?