home *** CD-ROM | disk | FTP | other *** search
- <%@ Register TagPrefix="Acme" TagName="SourceRef" Src="/quickstart/util/SrcRef.aspx"%>
-
- <!-- #include virtual="/quickstart/howto/include/header.inc" -->
-
- <script language="C#" runat="server">
-
- public void Page_Load(Object sender, EventArgs E)
- {
- // shell the explorer to a directory
- Ref.RunSample = Server.MapPath("/quickstart/howto/samples/net/WebRequests");
-
- // run an aspx page directly
- // Ref.RunSample = "/quickstart/howto/samples/BaseDataTypes/Sort/Sort.aspx";
-
- Ref.ViewSource = "/quickstart/howto/samples/net/WebRequests/clientPOST.src";
- Ref.Icon = "/quickstart/images/genicon.gif";
- Ref.Caption = "ClientPOST.exe";
- }
-
- </script>
-
- <h4>How Do I...Make a POST request?</h4>
-
- <div class="indent" style="width:660">
- <P>
- This sample illustrates using the WebRequest and WebResponse classes to make a POST request on a URI.</div>
- </P>
- <P>
- This sample is similar to a simple WebRequest with a GET verb. The difference here is twofold: 1) The verb needs to be changed to be
- POST, 2) the form information needs to be encoded and sent up the stream.
- </P>
- <P>
- To change the verb, simple set the <B>Method</B> property to "POST".
- </p><P>
- You must then set the <B>ContentType</B> property to "application/x-www-form-urlencoded". At this point, make sure that the string
- you supply is encoded correctly, and everything will be POSTed correctly.
- </P>
-
- <h4>Example</h4>
-
- <Acme:SourceRef id="Ref" runat="server" />
-
- <h4>Source Code</h4>
-
- <div class="code">
- <xmp>
- <!-- #include virtual="/quickstart/howto/samples/net/WebRequests/clientPOST.cs" -->
- </xmp>
- </div>
-
- <!-- #include virtual="/quickstart/howto/include/footer.inc" -->
-