Slacker Active Member Licensed User Longtime User Jun 10, 2013 #1 Hello Folks, i think lot of users have faced this aspect in their developing. I'm using a WCF REST Service and I need to handle the login and authentication process; using ASP.NET Form authentication was pretty easy being there are underlying integrated modules do the work behind the scenes using authentication cookie. Moving towards this technology and using HttpUtils2, i'm trying to image how i might recognize logged user having on the other side a WCF REST Service. I suppose i have to use cookie as expected to make the job but i would to know if you could suggest me - using the above-mentioned technology - to make the process smoother and easy. It should be appreciated a little of code how to handle auth cookie and authentication process (and how to handle the model "slide expiration" about logged session as ASP.NET do) using httputils2 framework and WCF REST Service. Thank you in advance!
Hello Folks, i think lot of users have faced this aspect in their developing. I'm using a WCF REST Service and I need to handle the login and authentication process; using ASP.NET Form authentication was pretty easy being there are underlying integrated modules do the work behind the scenes using authentication cookie. Moving towards this technology and using HttpUtils2, i'm trying to image how i might recognize logged user having on the other side a WCF REST Service. I suppose i have to use cookie as expected to make the job but i would to know if you could suggest me - using the above-mentioned technology - to make the process smoother and easy. It should be appreciated a little of code how to handle auth cookie and authentication process (and how to handle the model "slide expiration" about logged session as ASP.NET do) using httputils2 framework and WCF REST Service. Thank you in advance!
Erel B4X founder Staff member Licensed User Longtime User Jun 11, 2013 #2 Can you provide more information about the authentication protocol that is used in this case? Upvote 0
Slacker Active Member Licensed User Longtime User Jun 11, 2013 #3 Erel, in the previous model i used a cookie in asp.net to identify the user logged. I managed the logging process by code checking in DB and setting a cookie in browser to identify its session in subsequential http calls. In this case using WCF REST Service, i would to know using for example httputils2 framework what should be the best way to figure out because we have now an APP and not a web browser. Thank you Erel. Upvote 0
Erel, in the previous model i used a cookie in asp.net to identify the user logged. I managed the logging process by code checking in DB and setting a cookie in browser to identify its session in subsequential http calls. In this case using WCF REST Service, i would to know using for example httputils2 framework what should be the best way to figure out because we have now an APP and not a web browser. Thank you Erel.
Slacker Active Member Licensed User Longtime User Jun 11, 2013 #4 Is there no any way to recreate a model to identify the user as authenticated using httputils2 with WCF REST Service ? Should i have implement a custom logic by myself ? Upvote 0
Is there no any way to recreate a model to identify the user as authenticated using httputils2 with WCF REST Service ? Should i have implement a custom logic by myself ?
Erel B4X founder Staff member Licensed User Longtime User Jun 12, 2013 #5 Cookies are handled automatically by HttpClient. You can manually extract the cookies from the headers or add new cookies as you need. Upvote 0
Cookies are handled automatically by HttpClient. You can manually extract the cookies from the headers or add new cookies as you need.
Slacker Active Member Licensed User Longtime User Jun 12, 2013 #6 I'm using HttpJob object not HttpClient. You suggest to use this for WCF Service but i didn't see in it any methods or properties useful to handle the cookies/headers.... Upvote 0
I'm using HttpJob object not HttpClient. You suggest to use this for WCF Service but i didn't see in it any methods or properties useful to handle the cookies/headers....
Erel B4X founder Staff member Licensed User Longtime User Jun 13, 2013 #7 HttpUtils2 is based on HttpClient. You can see its code here: HttpUtils2 - Web services are now even simpler You can add headers to the request by calling: Job.GetRequest.SetHeader. Note that you should call it right after you call Job.Download. You will need to modify HttpUtills2Service in order to read the response headers. Upvote 0
HttpUtils2 is based on HttpClient. You can see its code here: HttpUtils2 - Web services are now even simpler You can add headers to the request by calling: Job.GetRequest.SetHeader. Note that you should call it right after you call Job.Download. You will need to modify HttpUtills2Service in order to read the response headers.
Slacker Active Member Licensed User Longtime User Jun 13, 2013 #8 THanks Erel, i was thinking what you told as modifying httputils2service to read response header....could show me some quick code snippet where could i point to regard to this response header stuff ? Thanks of all Erel. Upvote 0
THanks Erel, i was thinking what you told as modifying httputils2service to read response header....could show me some quick code snippet where could i point to regard to this response header stuff ? Thanks of all Erel.
Erel B4X founder Staff member Licensed User Longtime User Jun 16, 2013 #9 This is the current code in hc_ResponseSuccess: Code: Copy Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int) Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _ True, TaskId) End Sub You can access the headers in this sub. Upvote 0
This is the current code in hc_ResponseSuccess: Code: Copy Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int) Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _ True, TaskId) End Sub You can access the headers in this sub.