Last post Jan 14, 2012 10:30 PM by Vidhu1992
Jan 14, 2012 01:51 PM|Vidhu1992|LINK
I am trying to post data to a php page hosted on my server using an asp.net page. The function of the page is to sign me in to a forum (built in php hence the php page)
I have used httpwebrequest to "POST" my credentials to the php page. I get signed in successfully. How ever when i try and navigate to a new page in the forum. I am logged out.
When i try to post the same data using a normal html form. It works perfectly. i can navigate arround with no problems.
Why is this happening? can you please help me?
this is my code i use
Jan 14, 2012 02:37 PM|Careed|LINK
As most authentication is maintained through the use of a cookie, you are probably not creating a cookie for yourself and thus the PHP pages cannot maintain your authentication within the pages.
So, you could try, after logging in through your WebRequest, capturing the cookie is created in this process and then creating it as a actual cookie on your system. I'm not sure if this will work across different languages.
Jan 14, 2012 02:49 PM|Vidhu1992|LINK
Why do I need to create a cookie?
The php script should automatically create the cookie and store it in the
Because if a normal html form POST works, the vb should also work.
correct me if i am wrong
Jan 14, 2012 05:19 PM|Careed|LINK
When you are using WebRequest directly, it is not functioning as if it was in the same browser session as the web page you are on because it was initiated from the server through code-behind, not through the browser. Thus, there is no browser to set a cookie
in. This is why you need to capture the cookie, if possible, and transfer it to your client browser in order to use.
From an normal HTML POST, this would be coming directly from the browser on the client, thus it will function as expected. When screen-scraping from the server, it will treat this process as something different, especially since it has no real association
with the browser client from the server.
Jan 14, 2012 10:30 PM|Vidhu1992|LINK
thank for the explination. Is there any method to do the POST back from the code behind as if it was comming directly from the browser?