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

  • Home
  • SEARCH
  • 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 8206481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:41:15+00:00 2026-06-07T08:41:15+00:00

In my MVC3 app, if i type in a query string value in the

  • 0

In my MVC3 app, if i type in a query string value in the url and hit enter, I can get the value i typed:

localhost:34556/?db=test

My default action which will fire:

public ActionResult Index(string db)

The variable db has “test” in it.

Now, i need to submit a form and read the query string value, but when I submit the form via jQuery:

       $('#btnLogOn').click(function(e) {
         e.preventDefault();
             document.forms[0].submit();
         });

And the following is the form i’m sending:

   @using (Html.BeginForm("LogIn", "Home", new { id="form1" }, FormMethod.Post))

Heres the action:

  [HttpPost]
    public ActionResult LogIn(LogOnModel logOnModel, string db)
    {
        string dbName= Request.QueryString["db"];
     }

The variable dbName is null because Request.QueryString[“db”] is null, so is the variable db being passed in and i dont know why. Can someone help me get a query string variable after a form is submitted? 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-07T08:41:16+00:00Added an answer on June 7, 2026 at 8:41 am

    You could have something like

    Controllers:

    [HttpGet]
    public ActionResult LogIn(string dbName)
    {
        LogOnViewModel lovm = new LogOnViewModel();
        //Initalize viewmodel here
        Return view(lovm);
    
    }
    
    [HttpPost]
    public ActionResult LogIn(LogOnViewModel lovm, string dbName)
    {
        if (ModelState.IsValid) {
            //You can reference the dbName here simply by typing dbName (i.e) string test = dbName;
            //Do whatever you want here. Perhaps a redirect?
        }
        return View(lovm);
    }
    

    ViewModel:

    public class LogOnViewModel
    {
        //Whatever properties you have.
    }
    

    Edit: Fixed it up for your requirement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my MVC3 app, I'm using $.ajax to call a method of type JsonResult
In an MVC3 app, i have the following View: @using (Html.BeginForm(Index, Search, new {query
I'm trying to get the Kendo UI grid connected in my MVC3 app, but
I am building an MVC3 app that will require sending a mass email from
This is an MVC3 app. I have the following javascript call to my action:
I have an MVC3 app with a WCF service reference. Of course when im
I have an ASP.NET MVC3 app and when the user clicks on my anchor
I'm developing a ASP.Net MVC3 app which will have few hundred videos. I want
I've just implemented Elmah for logging in my MVC3 app, and of course all
i'm currently trying to make a asp.net mvc3 app. in the sample application which

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.