Converting ASP.NET to PHP in Web Development
You can post to an ASP.NET page with a standard HTML form like this:
<form action="/MyPage.aspx" method="post">
<input type="text" name="name" />
</form>
Then, in the code behind MyPage.aspx, you can access the form elements like this:
protected void Page_Load(object sender, System.EventArgs e)
{
string name = Request.Form["name"];
}
It should also be noted that most ASP.NET books will probably teach publishing to the same page. Then you can access the form elements on the page via objects and then execute Response.Redirect () to the next page you want to navigate to.
In this case, the aspx will look like this:
<asp:TextBox runat="server" id="Name" />
And you will access the value from codebehind like this:
protected void Page_Load(object sender, System.EventArgs e)
{
if(Page.IsPostBack)
{
string name = Name.Text;
}
}
a source to share
One of the biggest things to think about is the fact that you don't really have control over the back forms in classic ASP.NET WebForms. It was a big paradigm shift for me when I switched from PHP to ASP.NET. However, you have one handy item that can make things easier for you. In ASP.NET WebForms, you can access Session . You can store almost anything in a session and it will be visible between forms. The only thing you need to be careful about is that the sessions end .
a source to share
State-less
PHP is great for a stateless internet model. You can write simple forms from scratch and get them to do what you expect right away. However, ASP.NET bends the stateless model to make it look like desktop software development.
So my guess is that you are trying to type ASP.NET commands in notepad like you are used to in PHP, but that will probably lead to frustration.
Wizards
To understand how forms are structured and built, you might need to create a simple application using the wizards and tutorials provided in Visual Studio, then go under the hood and see what code it produced.
a source to share