Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
pagina.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="pagina3.aspx.cs" Inherits="pagina3" %>

 <!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 id="Head1"  runat="server">
 <title>HttpUtility Example</title>
 </head>
 <body>
 <form id="form1"  runat="server">
 <div>
 The raw url is: <br />
 <asp:Label id="UrlRawOutput"
 runat="server" />
 <br /><br />
 The url encoded is: <br />
 <asp:Label id="UrlEncodedOutput"
 runat="server" />
 <br /><br />
 The url decoded is: <br />
 <asp:Label id="UrlDecodedOutput"
 runat="server" />
 <br /><br />
 The query string NameValueCollection is: <br />
 <asp:Label id="ParseOutput"
 runat="server" />
 </div>
 </form>
 </body>
 </html>

pagina.aspx.cs
using System;
 using System.Collections.Specialized;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;

 public partial class pagina3 : System.Web.UI.Page
 {
 protected void Page_Load(object sender, EventArgs e)
 {
 String currurl = HttpContext.Current.Request.RawUrl;
 String querystring = null;

 // Check to make sure some query string variables
 // exist and if not add some and redirect.
 int iqs = currurl.IndexOf('?');
 if (iqs == -1)
 {
 String redirecturl = currurl + "?email=mAKq7tfZb9zufXHN5TyPMAxNgQhaTjbtPiidyqdXSBA=&valor=XOCf2J+PiAVo5SBiYbly2w==";
 Response.Redirect(redirecturl, true);
 }
 // If query string variables exist, put them in
 // a string.
 else if (iqs >= 0)
 {
 querystring = (iqs < currurl.Length - 1) ? currurl.Substring(iqs + 1) : String.Empty;
 }

 // Parse the query string variables into a NameValueCollection.
 NameValueCollection qscoll = HttpUtility.ParseQueryString(querystring);

 // Iterate through the collection.
 StringBuilder sb = new StringBuilder();
 foreach (String s in qscoll.AllKeys)
 {
 sb.Append(s + " - " + qscoll[s] + "<br />");
 }

 // Write the results to the appropriate labels.
 ParseOutput.Text = sb.ToString();
 UrlRawOutput.Text = currurl;
 UrlEncodedOutput.Text = HttpUtility.UrlEncode(currurl);
 UrlDecodedOutput.Text = HttpUtility.UrlDecode(currurl);

 }
 }


se alguém puder me ajudar.
if someone can help me. [Google Translate]

[edit]Just the Portuguese to English - OriginalGriff[/edit]
Posted
Updated 30-Jun-11 20:48pm
v3
Comments
Prerak Patel 1-Jul-11 3:11am    
What is the problem?

1 solution

Your question is not too clear. Though it sounds like you have issues with using Querystring.

For details of how to pass and use query strings, look here:
Passing variables between pages using QueryString[^]
Another link describing the same[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900