getting posted data

yaniv

Centurion
Joined
Apr 15, 2002
Messages
167
Location
israel
I need to get some data (two numbers) from PHP page, the developer in the PHP side say that he will use "POST" to sned me the nembers and that i should use GET to get it.

for five year with .NET i never needed to use this method... so, can some one please give the code for it?

thanks...
 
bri189a said:
Same as classic ASP:

C#:
Request[controlNameHere]

where do i put the page url?

and, if they building teat string ("total emails: 12, read: 6")- can i read it with out control?
 
Most people have either a ASP.NET or PHP application. There really is no reason for seperation. After re-reading your post it looks like you want a PHP web page to send the results to a ASP.NET code behind...that will never happen. The best you can get is to have a hyper link that has a query string in it that goes to an ASP.NET web page such as: <a href="someaspnetpage.aspx?id=17>Click Me</a> and then the ASP.NET web page in the page load would look at the QueryString property for "id".

If you in fact had an element on the page such as:

<input type=text id="txtUser"> and then the user put in a value of "asdf" you could manually get this value by doing as I said above in the code behind: Request["txtUser"] to get the value of the text box element.

But there is really no reason to do it this way with asp.net since you can have the text box element be as follows:

<asp:TextBox id="txtUser" runat="server"></asp:TextBox>

Then when the user enters a value you can either in the txtUser_TextChanged event or anywhere in the code behind for that matter (usually in an event that is handling a form submission such as a link button) you could get the value as follows:

C#:
string textValue = Me.txtUser.Text;

Or if your in the txtUser_TextChanged event you could also go:

C#:
string textValue = (sender as TextBox).Text;
//or
string textValue = ((TextBox) sender).Text;

as alternative ways to get the value, the way mentioned in the first code snippet is the usual method you will see though.

Nobody does what you are asking because either a) nobody mixes asp.net and php pages (it's not hard, just poor and unorthodox practice), or b) if I follow you correctly that you're trying to get a php page to post to an asp.net code behind, then it's not possible.
 
Well, it is not my choice to mix them.

may be i should eaplain the need and them it will be more easy.

i have linux server for e mail's purpose and win server (running .NET) for the web. my users asked to know, each time they enter our portal, to know if they have new mails, so that they will know they need to move to the webmail application.

since I don't run the linux server i asked the developer there to create a page that get the user name and pass in return number of "new emails=..." it looked very simple for me that i will find a way to get the incoming number. but, when i read it as text i get jiberish... so i thought about "post" and "get".
 
Well a simpler way would just be to use pop 3 protocol to check the mail server yourself from your application and avoid the middle man and forgive me for being brutally honest, have a better design. Most mail servers support this well tested and long supported protocol.
 
Back
Top