.htaccess password protect

Thursday, February 28th, 2008
  1. Make an .htpasswd file. The htpasswd command in Unix does this. You should put the password file outside of your web directory. So a command like “htpasswd -bc /home/matt/.htpasswd review donotenter” will create a new file using a username of review and a password of donotenter into the file /home/matt/.htpasswd . If you were to run the command “cat /home/matt/.htpasswd” you might see a line like “review:M1OdtjdGiDn1Y”.
  2. Make an .htaccess file. In this case, the file would be located at /home/matt/www/.htaccess and it would look something like
    AuthUserFile /home/matt/.htpasswd
    AuthName EnterPassword
    AuthType Basic
    <Limit GET POST>
    require valid-user
    </Limit>

http://www.mattcutts.com/blog/htaccess-101/

http://www.maths.ox.ac.uk/help/faqs/www/htaccess

JSF pageContext - think I might need this!

Friday, February 22nd, 2008

http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/PageContext.html

JSF - I just want it to work like .NET! Just an event like Page_Load please!

Friday, February 22nd, 2008

http://forum.java.sun.com/thread.jspa?threadID=541382&forumID=427

- useful: ${pageContext.request.contextPath}

JSF - Yes thats right I am doing Java now!

Thursday, February 21st, 2008

http://www.coreservlets.com/JSF-Tutorial/

.Net Page Lifecycle

Tuesday, February 19th, 2008

The Life Cycle of a page when requested for the first time:

Initializing: During this phase, the server creates an instance of the server control

Loading: During this phase, the instance of the control is loaded onto the page object in which it is defined.

PreRendering: During this phase, the control is updated with the changes made to it. This prepares the control for rendering.

Saving: During this phase, the state information of the control is saved. For example, if a value is set for the control during the Load event, it is embedded in the HTML tag that will be returned to the browser.

Rendering: During this phase, the server creates the corresponding HTML tag for the control.

Disposing: During this phase, all cleanup tasks, such as closing files and database connections opened by the control are performed.

Unloading: During this phase, all cleanup tasks, such as destroying the instances of server control are performed. This is the final event in the life cycle of a server control

Life cycle when the page processed during a postback event

The processing sequence in which a page is processed during a postback event is:

Initializing: During this phase, the server creates an instance of the server control

Loading view state: During this phase, the view state of the control posted by the client is reloaded into the new instance of the control.

Loading: During this phase, the instance of the control is loaded onto the page object in which it is defined.

Loading the postback data: During this phase, the server searches any data corresponding to the control that is loaded in the data posted by the client.

PreRendering: During this phase, the control is updated with the changes made to it. This prepares the control for rendering.

Saving state: During this phase, the change in the state of control between the current request and the previous request of the page is saved. For each change, the corresponding event is raised. For example, if the text of a textbox is changed, the new text is saved and a text_change event is raised.

Rendering: During this phase, the server creates the corresponding HTML tag for the control.

Disposing: During this phase, all cleanup tasks, such as closing files and database connections opened by the control are performed.

Unloading: During this phase, all cleanup tasks, such as destroying the instances of server control are performed. This is the final event in the life cycle of a server control

The events associated with the relevant page cycle phases are:

  • Page Initialization: Page_Init

  • View State Loading:LoadViewState

  • Postback data processing: LoadPostData

  • Page Loading: Page_Load

  • PostBack Change Notification: RaisePostDataChangedEvent

  • PostBack Event Handling: RaisePostBackEvent

  • Page Pre Rendering Phase: Page_PreRender

  • View State Saving: SaveViewState

  • Page Rendering: Page_Render

  • Page Unloading: Page_UnLoad

http://www.beansoftware.com/ASP.NET-Tutorials/Page-Life-Cycle.aspx

http://msdn2.microsoft.com/en-us/library/ms178472.aspx

A little basic but useful referance - Print page javascript

Monday, February 18th, 2008

http://www.456bereastreet.com/archive/200709/how_to_create_an_unobtrusive_print_this_page_link_with_javascript/

Google Base c#

Sunday, February 17th, 2008

Just getting into automating google base feeds:

http://code.google.com/apis/base/csharpdevguide.html#inserting

Session state in generic handlers

Thursday, February 14th, 2008

http://techleppie.wordpress.com/2006/10/01/session-state-and-generic-handlers/

The solution to my problem : IRequiresSessionState. I had never come across this interface before but it was the magic key!

According to MSDN :- Specifies that the target HTTP handler requires read and write access to session-state values. This is a marker interface and has no methods.

However, if you only require readonly access then alternatively it is better to make use of IReadOnlySessionState. This will have a performance improvement and provide more scalability.

you can implement multiple interfaces using a ‘,’ see below:

public class process : IHttpHandler, System.Web.SessionState.IReadOnlySessionState {

C# Generics - interesting article

Thursday, February 14th, 2008

http://www.willasrari.com/blog/c-generics/000191.aspx

Extending .NET web controls

Thursday, February 14th, 2008

http://www.codeproject.com/KB/webforms/customhtmlattributes.aspx