I wrote code in notepad and gave the extension as hello.php but it didn't change to web and so it did not run.
Secondly ,I wrote code in Visual Studio asp.net web application

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="phphello._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <?php
echo "My first PHP script!";
?>
    </div>
    </form>
</body>
</html>

When I run this,it will open localhost site but it will be blank page with the title as untitled page.
I want to know how to work on php in asp.net web application and also using notepad.

Recommended Answers

All 2 Replies

Do you have a local server installed for PHP, because if you run from VS it uses the built-in webserver. Second is you can't use both ASP.NET and PHP in the same script. It's one or the other.

You can use Visual Studio do develop your PHP pages, but you use web forms (.aspx) pages to do that. as Pritaeas mentioned... you cannot mix the two. This is because if the page is saved as .aspx, then when requested, the asp.net engine will process and the PHP code is unrecognized.

If you want a PHP page in Visual Studio, you can "add a new item", choose HTML, then just rename the page to have an extension of .php.

I'm not necessarily recommending that you use Visual Studio for PHP development, but it can be done if this is the editor of your choice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.