IIS 5 & IIS 6
Form based auhentication using ISAPI filter
Last post Jan 08, 2008 01:15 PM by anilr
Dec 27, 2007 06:17 AM|imd|LINK
I have to perform form based auhentication using ISAPI filter. When the user enters the username and password in a form and posts it, how do i get the data entered by the user ?
I cannot use ASP or anything like that. Have to create a custom ISAPI authentication filter for the purpose ?
Dec 27, 2007 08:52 AMemail@example.com|LINK
Forms authentication is a function of ASP.NET, not an ISAPI filter. You could always write an ISAPI filter that sets a cookie or other login token based on login credentials, or you could use Windows authentication, or stuck with ASP.NET forms authentication.
It all depends on what you're trying to accomplish.
Dec 27, 2007 09:35 AM|imd|LINK
All i would need is to get the data that has been entered in the form ie. the values entered in the username and password fields.
Dec 28, 2007 12:14 AM|steve schofield|LINK
I suggest try not to reinvent the wheel when the .NET framework provides this functionality by default.
Windows Server MVP - IIS
Log archival solution
Install, Configure, Forget
Dec 31, 2007 02:26 AM|imd|LINK
is there a way in which i can get the data that has been sent as a http post request ?
POST /index.htm HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
All i need is to get this string "userName=user&userPassword=pass"
Dec 31, 2007 03:44 AM|anilr|LINK
Only way to get it from an ISAPI filter is using SF_NOTIFY_READ_RAW notification which is not supported in worker process isolation mode in IIS6 - also there is no way to set non-windows based authenticated user with an ISAPI filter - you would be much better
writing an ISAPI extension and using HSE_REQ_EXEC_URL to set the authenticated user (only available on IIS6 and later) - of couse, using the already available forms auth in asp.net is probably the best/easiest way.
Dec 31, 2007 03:58 AM|imd|LINK
Thank you. Thats what i was looking for
Jan 08, 2008 10:31 AM|imd|LINK
IIS by default does not accept POSTing data to a HTML page. and if any such request comes it gives a 405 error.
What should i do to make IIS allow POSTing data to a HTML page ?
Thanks & Regards
Jan 08, 2008 01:15 PM|anilr|LINK
html files are just static files which are just served as-is, so POSTing to them makes no sense - if your html files actually contains dynamic content, map them to a dynamic script processor and you will be able to configure what verbs you want to support.