by Saurabh
31. March 2006 16:59
Many Windows Server 2003/IIS 6 Web hosts provide php & Perl among other goodies. And if you happen to be among the rare people who work on both Microsoft .net & LAMP technologies like me ;) you must absolutely adore this new cool capability in ASP.net 2.0 that allows you to post data to a php/Perl page. Though you can literally post to a page written in any language using the technique, I'm focusing on a specific example illustrating the ability to post form data to a php page using ASP.net 2.0.
Note: I am talking about sending form data using the POST method, not by appending anything to the URI.
Say you have this basic page with a simple form.
1: <%@ Page Language="C#" %>
2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3: <script runat="server">
4: protected void Button1_Click(object sender, System.EventArgs e)
5: {
6: Label1.Text = "Hello " + TextBox1.Text + "<br />" + "Date Selected: " + Calendar1.SelectedDate.ToShortDateString();
7: }
8: </script>
9: <html xmlns="http://www.w3.org/1999/xhtml" >
10: <head runat="server">
11: <title>Cross Page Posting</title>
12: </head>
13: <body>
14: <form id="form1" runat="server">
15: <div>
16: Enter your name: <br />
17: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
18: <p>
19: When do you want to fly?<br />
20: <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
21: </p>
22: <br />
23: <asp:Button ID="Button1" runat="server" Text="Post2Self" OnClick="Button1_Click" />
24:
25: <asp:Button ID="Button2" runat="server" Text="Post2php" PostBackUrl="PostBackAcceptor.php" />
26: <p>
27: <asp:Label ID="Label1" runat="server"></asp:Label>
28: </p>
29: </div>
30: </form>
31: </body>
32: </html>
So now we can have a simple php page that can dump POST data as output, like this…
1: <?php
2: echo '$_POST["TextBox1"]';
3: echo " » ";
4: echo '$_POST["TextBox1"]';
5: echo "<br />";
6: echo '$_POST["Button2"]';
7: echo " » ";
8: echo '$_POST["Button2"]';
9: ?>
The output we get; should be obvious to people who know both php & ASP.net ;)
$_POST["TextBox1"] raquo; Chad
$_POST["Button2"] raquo; Post2php
Though some people might say there's no reason to do this considering the explosion of web services in our Web 2.0 era. But there are a number of scenarios where this could come in handy.
Say you had some old (but very useful) piece of php code you wanted to use in an ASP.net 2.0 project and either you want to cut back on time or maybe you're lazy! Or perhaps the data you're working on is on the same server or network. It wouldn't make sense using a web service in that case, now would it?
Or perhaps you are way too paranoid about sharing your data (I know a couple of people like that).
Whatever your reasons be… "PostBackUrl" is a double blessing for people like us.
by Saurabh
20. March 2006 16:51
Ahh! So I've made an incredibly smooth transition, that is I've upgraded my site to run on Community Server 2.0 under ASP.net 2.0. The most obvious change you've already noticed is the default CS 2.0 theme, which I like by the way. Though it lacks any of my trademark "Dark Knight" looks. I'm going to keep it for a while until I build myself a theme which is compatible with the new version. Among the huge number of improvements and new features the one I've started to adore and will start using on a large scale is the Photo Gallery, which wasn't that great on the previous version IMHO, hence I never used it.
Kudos to the Community Server team at Telligent for making a hugely impressive build. Although it provides "minimal" (these are the words used by folks at Telligent) Content Editing functionality, the work they've done with AJAX in this build, I think is by far the coolest thing in this version.
by Saurabh
6. March 2006 16:46
In his review of the February (Enterprise) CTP, Paul Thurrott is reporting that there has been a major back track on part of Microsoft as far as Virtual Folders are concerned. This sucks! I gotta tell you Virtual Folders was appearing to be the most powerful feature of Vista. And I can't understand if they have it working great, why cut out one of the most exciting features? Why not make it a little less visible like Sidebar (which isn't activated by default)? It would be really great feature for power users like me.
Update - Paul wrote to me on the 6th saying that Virtual Folders are still available, that "... they aren't removed completely; there is a Saved Searches folder that contains pre-built virtual folders, and of course you can still create your own virtual folders by saving searches. They're not as prominent in the shell as they used to be, but they're still there for the most part.
Paul"