Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8802757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:09:57+00:00 2026-06-14T01:09:57+00:00

my link is like http://localhost/default.aspx?phone=9057897874&order=124556 Here Is my basic Page for passing Parameter In

  • 0

my link is like

http://localhost/default.aspx?phone=9057897874&order=124556

Here Is my basic Page for passing Parameter In URL from ASP.net

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"     Inherits="WebApplication2._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 method="get" action="default.aspx">

<label>Phone No</label>
<input type="text" name="phone" />
<br />
<label>Order No</label>
<input type="text" name="order" />
<br />
<input type="submit" value="submit" />
<br />
</form>

my c# file where I can store the prameters in Variables

namespace WebApplication2
 {
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strQuery;

        string phone = Request.QueryString["phone"];
        if (phone != null)
        {
            Response.Write("phone no is ");
            Response.Write(phone);
        }
        else

        {
            Response.Write("You phone number is not correct");
        }

        string order_no = Request.QueryString["order"];
        if (order_no != null)
        {
            Response.Write("Order No is ");
            Response.Write(order_no);
        }
        else
        {
            Response.Write("You Order number is not correct");
        }

//How I can Connect to Mysql Server

        strQuery = "SELECT order_status where orde01=''" + order_no + "'' and phone01=''" + phone + "''";

        Response.Write(strQuery);
}
}

I’m trying to doing something like this but it’s only give me whole query as string.
I am new on this topic.
Any help will be appreciate
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:09:58+00:00Added an answer on June 14, 2026 at 1:09 am

    First off, concatenating a sql statement based on input that the user can change, especially when stored as a string is how SQL Injection Vulnerabilities are created. Don’t be that guy.

    as for tokenalizing your query string, use named parameters. assume this is your query string

    ?orderid=777&phone=777-777-7777
    
    Response.QueryString["orderid"] 
    

    would return ‘777’ and

    Response.QueryString["phone"] 
    

    woudl return ‘777-777-7777’

    as for your sql injection issue, you have a couple options. one is a parameterized sql statement, see the C# example here: http://rosettacode.org/wiki/Parametrized_SQL_statement
    or use a stored procedure with parameters. the least desirable but minimally acceptable option is to regex validate your input parameters strictly, especially killing characters like ‘=;% — and a few others.

    EDIT: now that I’ve had some time to work up a sample, check this out. This sample needs to be customized to your database, but its working on my mysql DB with a test table. you will need to install the MySQLConnector pack and add a project reference to ‘MySql.Data’ before the code will compile correctly.

    namespace WebApplication2
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e) {
                //define some regex patterns for validating our data.
                const string PHONEREGEX = @"((\(\d{3}\))|(\d{3}-))\d{3}-\d{4}";
                const string ORDERNUMREGEX = @"\d*";
    
                bool isValid = true;
    
                string phone = Request.QueryString["phone"]; //read phone from querystring.
    
                //validate that arg was provided, and matches our regular expression. this means it contains only numbers and single hyphens
                if(!string.IsNullOrWhiteSpace(phone) && System.Text.RegularExpressions.Regex.IsMatch(phone, PHONEREGEX)){
                    Response.Write(HttpUtility.HtmlEncode(string.Format("The phone number is {0}", phone))); //HTML Encode the value before output, to prevent any toxic markup.
                } else {
                    Response.Write("Phone number not provided.");
                    isValid = false;
                }
    
                string orderStr = Request.QueryString["order"]; //read ordernum from querystring
                long order = long.MinValue;
    
                //validate that order was provided and matches the regex meaning it is only numbers. then it parses the value into 'long order'.
                if(!string.IsNullOrWhiteSpace(orderStr) && System.Text.RegularExpressions.Regex.IsMatch(orderStr, ORDERNUMREGEX) && long.TryParse(orderStr, out order)){
                    Response.Write(HttpUtility.HtmlEncode(string.Format("The order number is {0}", order))); //use 'long order' instead of orderStr.
                } else {
                    Response.Write("Order number not provided.");
                    isValid = false;
                }
    
                //if all arguments are valid, query the DB.
                if (isValid) {
                    Response.Write(GetOrderStatus( phone, order));
                }
    
            }
    
            private static string GetOrderStatus(string phone, long order) {
                string status = "";
    
                //create a connection object
                string connstring = "SERVER=<YOUR MYSQL SERVER>;DATABASE=<YOUR DATABASE>;UID=<YOUR USER>;PASSWORD=<YOUR PASSWORD>-";//this is a connection string for mysql. customize it to your needs.
                MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connstring); //put your connection string in this constructor call 
    
                //create a SQL command object
                using (MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand()) { //use a using clause so resources are always released when done.
                    cmd.Connection = conn;
                    cmd.CommandText = "SELECT `Order_Status` FROM `<YOUR TABLE>` WHERE `Order` = @order AND `Phone` = @phone"; //this needs a From statement 
    
                    //add parameters for your command. they fill in the @order and @phone in the sql statement above. customize these to match the data types in your database.
                    cmd.Parameters.Add("order", MySql.Data.MySqlClient.MySqlDbType.Int64,11).Value = order; //do not use @ sign in parameter name
                    cmd.Parameters.Add("phone", MySql.Data.MySqlClient.MySqlDbType.VarChar, 50).Value = phone;
    
                    //execute the command, read the results from the query.
                    cmd.Connection.Open();
                    using (MySql.Data.MySqlClient.MySqlDataReader reader = cmd.ExecuteReader()) {
                        while (reader.Read()) {
                            status = reader.GetString("Order_Status");
                        }
                        cmd.Connection.Close();
                    }
    
                }
                return status;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C# & Java Script I have the link like this http://localhost/Server/Vehicle/Vehicle.aspx?appid=5 , when
I am currently in a page that its url is http://localhost:49852/Default.aspx?MID=17 in this page
I want to visit a page like... http://mysitelocaltion/user_name/user_id This is just a virtual link,
I want to pass url link like http://localhost:24873/Jobs/[companyname] or http://localhost:24873/[companyname]/Jobs/ (Preferred) I tried below
I have link like this: http://localhost/BandTemplate/admin/galleries How can I get to the last segment
In my website there is a link like this http://backlinks.cheapratedomain.com/backlinks.php?url=emobileload.com for better SEO I
How to create UIImageView with image from a link like this http://img.abc.com/noPhoto4530.gif ?
If I have a link of a picture like that: http://www.google.com/images/srpr/logo3w.png Can I retrieve
When I copy a YouTube link, like this one, for example (http://www.youtube.com/watch?v=_Ka2kpzTAL8), and paste
i am having the link like <a href=http://twitter.com/home/?status='.$markme_ddesc.' onclick=OpenPopup(this.href); return false>Click Here to See

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.