Entries Tagged With 'Programming'
Getting Forms Authentication Timeout from web.config programmatically
I have to create Forms Authentication ticket's on my own for some parts of a web application. I won't get into the why as it's a bit complicated, so trust when when I say that I need to.
I wanted to rely on defaults as much as possible so when I went to set the default timeout I was astounded to find that it wasn't available easily through code. I didn't just want to hardcode the value of '30' minutes because it can be overridden in the web.config.
So I hit Google figuring someone's run into this before, and they had with no better conclusion. Scott Hanselman listed a whole bunch of methods that were attempted but failed and eventually ended up using xpath to access the value directly from the file. That's 2004, 5 years ago, I figured there had to be a better way.
I ran to Reflector and looked at how the forms authentication timeout is initialized in the first place.
AuthenticationSection authentication = RuntimeConfig.GetAppConfig().Authentication; ... _Timeout = (int)authentication.Forms.Timeout.TotalMinutes;
It just loads the config section and accesses it directly. Nothing really preventing me from doing just that. A little extra help on accessing the System.Web section from dotnetcurry.com and here is what I came up with:
Configuration config =
WebConfigurationManager.OpenWebConfiguration( "~" );
AuthenticationSection authentication =
(AuthenticationSection)config.GetSection(
"system.web/authentication" );
return (int)authentication.Forms.Timeout.TotalMinutes;As an added bonus, even if the Timeout isn't specified in the web.config, it will return the default of 30 minutes. Add some error handling for the cases with the section or value are not present and voila.
Creating a Setup Package for a Custom SSIS Data Flow Component
To make an installation package for a custom SSIS component the .dll(s) that make up the component must be installed into two places:
- For design time it needs to be installed in the SQL Server's pipeline components folder
C:\Program Files\Microsoft SQL Server\90\DTS\PipelineComponents - For runtime it needs to be installed in the GAC
All your setup package has to do is install the .dll(s) into both of these places and you are ready to rock n' roll. This micro-howto doesn't cover aspects of the GAC (like signing code) or developing an SSIS component, for those topics I would recommend www.sqlis.com. Read on for notes on creating an installation package.
Read more...Front page on dzone.com
It is a relatively new site so this doesn't really get filed under earth shattering or momentous, but it is kinda cool. Now I'll just sit tight and let the clicks roll in... all 30 or so of them ;-) Either way, it got 6 votes while I still only have 3 diggs, proving that digg sucks twice as much as dzone. Props to Basil for the submission.
Parsing Incomplete or Malformed URLs with Regular Expressions
This is part 1 of a two part article on url handling. Part 2 will talk about normalizing and joining urls (a link will be posted when it is up).
Read more...Connecting A Submenu In Interface Builder
The easiest way to dynamically change menus at runtime is to link the menu in the nib to a variable in your class. This is relatively easy todo if you are connecting a non-submenu item:
- Create an IBOutlet variable:
IBOutlet NSMenu *clientMenu;
- Drag the header file for the controlling class onto the nib
- Instantiate it in instances and make the connection (make connections by holding ctrl down and dragging from one object to another).
But if you want to connect to a submenu it is harder because there is not graphical representation that you can connect it to. The solution here is to use the outline mode.
Read more...Querying the motor controller on a handyboard
For my master's thesis I need a handyboard to control both a small robotic experiment and a computer that records data. There are many small glitches that I have run into and I will be posting them here so other users of the handyboard can use what I have learned.
Read more...










