Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    asp.net url variables to populate form fields and/or auto submit

    I have a shortcut on my desktop to a login page for a website I use quite often. Every time I go there I have to reenter my user name and password.


    The desktop URL shortcut I have is
    http://domain.com/service/Login.aspx


    I’ve tried adding the following changes
    http://domain.com/service/Login.aspx...ssword=joshua1


    But this doesn’t auto populate the fields on the website when it loads. Is there something special I need to do so the webpage will fill in the fields on the form?

    Also bonus if I could just auto submit to login so I don’t need the page to load and have me click “login” but I don’t think that’s possible… or is it?
    Any help is greatly appreciated.

  • #2
    Regular Coder
    Join Date
    Dec 2007
    Posts
    137
    Thanks
    1
    Thanked 21 Times in 21 Posts
    Your login page is not set-up to parse the values (your password and username) in your URL, so that is why you can't just send them via your URL and retrieve them via a GET request. To do so, you'll need to add code which uses the Request.Querystring object to retrieve your username and password values from the URL, something like:

    string username = Request.Querystring["username"];
    string password = Request.Querystring["password"];

    This stores the Request objects into string variables and then you can use them however you want, in your case, pass them to the login control or whatever code you are using for the login validation.

    You'll want to put the code to the get the Request objects, your username and password values from the url, in your Page_Load event in your aspx page (ie. in your login.aspx.cs page) so it'll grab them once the page is loaded. This is important.

    Again, hard to answer your question without knowing your login script and which version of ASP.NET you are using, or which language (C# or VB) you are using.

    Search for "Request.Querystring", "ASP.NET Page_Load" event and "ASP.NET Login Control" and you should find info on what to do.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •