Came across this reading list here.
This one comes from John Brewer.
Enjoy!
Ideas and thoughts about Microsoft Identity, C# development, cabbages and kings and random flotsam on the incoming tide
Tuesday, May 01, 2007
ASP : Getting configuration variables from web.config
Instead of hard-coding these in the .cs code, you could use the following:
string inputFile = ConfigurationManager.AppSettings.Get("FileLoc");
In the web.config, in the appSettings section, enter something like:
LSBadd key="FileLoc" value="C:\somewhere\File.xml" /RSB
where:
LSB = Left square bracket
RSB = Right square bracket
You can also do this from Visual Studio when viewing an .aspx page. Click Website / ASP.NET configuration and type in the entries there.
Enjoy!
string inputFile = ConfigurationManager.AppSettings.Get("FileLoc");
In the web.config, in the appSettings section, enter something like:
LSBadd key="FileLoc" value="C:\somewhere\File.xml" /RSB
where:
LSB = Left square bracket
RSB = Right square bracket
You can also do this from Visual Studio when viewing an .aspx page. Click Website / ASP.NET configuration and type in the entries there.
Enjoy!
ASP : Creating Javascript on the server side
Javascript is normally created in the HTML file but it can be created on the server side.
e.g. the script to open another window could be:
where:
LSB = Left square bracket
RSB = Right square bracket
Enjoy!
e.g. the script to open another window could be:
string exampleScript =
"LSBscript language='javascript'RSB\n" +
"window.open ('http://some url', '_blank', " +
"'scrollbars=yes,resizable=yes,status=yes" +
",toolbar=no,menubar=yes,location=no" +
",width=screen.availWidth" +
",height=screen.availHeight" +
",screenX=0,screenY=0,top=0,left=0');\n" +
"LSB/scriptRSB";
ClientScript.RegisterStartupScript(typeof(Page), "ExampleScript", exampleScript);
where:
LSB = Left square bracket
RSB = Right square bracket
Enjoy!
C# : Creating dates
The simplest way is to use:
Enjoy!
string thisDate = "1990-01-01";
DateTime datetime = DateTime.Parse (thisDate);
Enjoy!
Subscribe to:
Posts (Atom)