Navigate a URL with Query string values on click of hyperlink

I have a control with 'email' and 'password' textboxes and a 'autoLogin' checkbox. All are web form controls (not html controls). And there is a 'Login' hyperlink. When I click on heperlink, I want to move to other page using NavigateUrl property like below:


how to pass and how to get the query string?

Thanks in Advance...

-------------Problems Reply------------

private void btnSubmit_Click(object sender, System.EventArgs e)
Response.Redirect("Webform2.aspx?Email=" +
this.txtemail.Text + "&Pwd=" +

now for the next page(Webform2.aspx) go there and in page load event write this code

private void Page_Load(object sender, System.EventArgs e)
string Email = Request.QueryString["Email"];
string password = Request.QueryString["Pwd"];

You can use this one also

private void Page_Load(object sender, System.EventArgs e)
string Email = Request.QueryString[0];
string password = Request.QueryString[1];

place this values where You Want

The easiest way would be to not use a hyperlink but a button (or link button) and make a postback and then use, Response.Redirect("Url") or event better, process the login directly. Otherwize you have to collect your data using javascript.

On Login Click write this code

Response.Redirect("~/DoLogin.aspx?email=" + txtEmail.txt + "&pwd=" + txtPwd.text)

I'm assuming your doing this because your DoLogin page has some login code in the Page_Load?

I really wouldn't recommend passing username/password credentials in a URL.

Like @Magnus has stated, it would be better to change the Hyperlink to a LinkButton and put your code in there.

Category:c# Views:1 Time:2011-06-02

Related post

  • mod-rewrite redirect url with query string to static url 2011-11-28

    This has resulted in much hair pulling. I'm trying to redirect a URL with a query string to a static-looking URL - I want the URL to actually change if the URL with query string is entered. Thus, if the user navigates to:

  • change url or query string wihout reloading using jquery plugin 2010-05-06

    Hi I want to change the url or query string without reloading the page... I have used the QUERY STRING OBJECT plugin for jquery I have this example page in which on click of a album it should change the query string... Now i can change the url using

  • How can I test route/action resolution of URL with query string? 2010-05-25

    I'm trying to use code such as the following in my unit tests, /* Test setup code */ _routes = RouteTable.Routes; MvcApplication.RegisterRoutes(_routes); //set up the routes as they would be in actual application /* test code */ Expression<Func

  • how to detect of a requested url contains query string? 2010-09-26

    hi all i want to detect if a requested url contains query string or not how to do so ? --------------Solutions------------- You can directly use getQueryString() method OR You can check if your url has a query string or not by splitting it on "?" or

  • How to use UrlRewriteFilter to remove ".jsp" from a url with query string 2011-07-26

    For some reason, I need to remove ".jsp" from a Url with query string in a Spring MVC project, using UrlRewriteFilter. For example, I want to change http://localhost:8080/admin/project.jsp?m_product=GA&m_code1=QULQ2U to http://localhost:8080/admi

  • Sitemap url with query string 4.0 2011-11-22

    i am facing a big problem regarding persisting querystring attach with sitemap url suppose i have three page home > page1 > page2 i have one link which redirect me to page1 with query string like id=1 page1 i know how to attach query string wit

  • URL with query string validation using PHP 2011-12-14

    I need a PHP validation function for URL with Query string (parameters seperated with &). currently I've the following function for validating URLs $pattern = '/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)[email protected])?([\d\w][

  • Get url from query string and load it in div 2014-01-09

    I'm designing a simple ASPX page which has two div's. The first div has static contents. The content in the second i want to be dynamic. I want the user to give URL in query string and that URL i need to show in my second div. So far i have done this

  • Cakephp Form create add url as query string 2014-05-09

    When we use below method it adds url as query string $this->Form->create('ProductRating',array('id'=>'validateForm')); we get this url "/products/review_reply/17?url=products%2Freview_reply%2F17" How to prevent adding url as query string ? A

  • regex for URL including query string 2010-02-26

    I thought this would be a simple google search but apparently not. What is a regex I can use in C# to parse out a URL including any query string from a larger text? I have spent lots of time and found lots of examples of ones that don't include the q

  • Combine friendly url and query string 2010-05-19

    How to make a working url like this: --------------Solutions------------- It is possible by setting $config['enable_query_strings'] = TRUE; in your config.php file (As DamienL answered). I just tried with

  • mod_rewrite: how to strip url of query string yet retain it's values 2010-10-28

    I'd like to strip a URL of it's query string using mod_rewrite but retain the values of the querystring, for example, id like to change: to a nice clean: but retain the values of lorem and

  • Url minus query string in Objective-C 2010-11-24

    What's the best way to get an url minus its query string in Objective-C? An example: Input: Output: Is there a NSURL method to do this that

  • Redirect URL using Query String parameter in URL 2010-12-20

    I have a bunch of URLs from an old site that I recently updated to EE2. These URLs look like this: These URLs will need to redirect to: Not all Fo

  • is there any method to get url without query string in java script 2011-04-28

    I have a URL like : http://localhost/dms/mduserSecurity/UIL/index.php?menu=true&submenu=true&pcode=1235 I want to get the URL without the query string: http://localhost/dms/mduserSecurity/UIL/index.php Is there any method in JavaScript, not i

  • .htaccess: rewrite URL with query strings 2011-05-17

    I need to rewrite a URL using an .htaccess and the URL has two query strings. Here is my raw URL: How do I get that to be written as:

  • Replace an img src value based on a referring URL's query string 2011-05-24

    I have a Magento store and I would like to replace the src value of an img based on whether the referring URL contains a specific querystring or querystring value (adnetwork=as) and if not simply leave the image as it is. Is this simple enough to do,

  • CakePHP send current url as query string when user is redirected to login 2011-07-01

    In CakePHP when a user tries to access an action that is protected with the Auth component they are redirected to the login page. So for example if I tried to acccess: it would take me to What I want to do

  • Nutch 1.2 - Why won't nutch crawl url with query strings? 2011-08-12

    I'm new to Nutch and not really sure what is going on here. I run nutch and it crawl my website, but it seems to ignore URLs that contain query strings. I've commented out the filter in the crawl-urlfilter.txt page so it look like this now: # skip ur

Copyright (C), All Rights Reserved.

processed in 0.096 (s). 11 q(s)