Tuesday, June 7, 2011

Batch file to start up cygwin and bash

Put this file cw.bat in your scripts folder or somewhere on your path to easily fire up cygwin when needed:


@if not "%cygwin%"=="" goto ALREADY_SET 


@REM Set cygwin path here:
@SET cygwin=C:\cygwin\bin
@if exist %cygwin% set PATH=%cygwin%;%PATH%
@if not exist %cygwin% goto NOT_FOUND
@echo cygwin set up successful.
@goto END


:ALREADY_SET
@echo cygwin alredy set up.
@goto END


:NOT_FOUND
@echo cygwin path not found:
@echo %cygwin%
@goto END


:END


Also useful is this to start bash:


@echo off
C:
chdir C:\cygwin\bin
bash --login -i

Wednesday, June 1, 2011

ASP.NET Request.Url properties

Original source for these details: http://www.xcess.info/request_url_parameters_details_asp_net_aen.aspx
Why this isn't in the msdn docs is beyond me!

Example URL : http://localhost:2000/virtual_dir/myrep/page.aspx?q=qvalue

Request.ApplicationPath : /virtual_dir
Request.CurrentExecutionFilePath : /virtual_dir/myrep/page.aspx
Request.FilePath : /virtual_dir/myrep/page.aspx
Request.Path : /virtual_dir/myrep/page.aspx
Request.PhysicalApplicationPath : d:\Inetpub\wwwroot\Websitename\virtual_dir\
Request.QueryString : /virtual_dir/myrep/page.aspx?q=qvalue
Request.Url.AbsolutePath : /virtual_dir/myrep/page.aspx
Request.Url.AbsoluteUri : http://localhost:2000/virtual_dir/myrep/page.aspx?q=qvalue
Request.Url.Host : localhost
Request.Url.Authority : localhost:2000
Request.Url.LocalPath : /virtual_dir/myrep/page.aspx
Request.Url.PathAndQuery : /virtual_dir/myrep/page.aspx?q=qvalue
Request.Url.Port : 2000
Request.Url.Query : ?q=qvalue
Request.Url.Scheme : http
Request.Url.Segments : /
  virtual_dir/
  myrep/
  page.aspx