Click here to Skip to main content
15,878,748 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
I have a windows application that has a link that when clicked it sends two parameters to an MVC application and both need to display. These parameters are on the URL like this :
HTML
http://localhost:49224/?Name=L%20Dube&Employee=ANAR3701


When I accept the parameters on my MVC application the Employee parameter is NULL but the Name does have a value and I am not sure why this is. When I accept the parameters I use a session so that I do not lose the value. Below is my action method:
C#
public ActionResult Intro(string Name, string Employee)
     {
         if (!string.IsNullOrEmpty(Name) || !string.IsNullOrEmpty(Employee))
             Session["Name"] = Name;
             Session["Employee"] = Employee;

             string strName = string.Empty;
             string strEmployee = string.Empty;

              if (Session["Name"] != null)
                 strName = Session["Name"].ToString();
              if (Session ["Employee"] != null)
                 strEmployee = Session["Employee"].ToString();

         ViewBag.ClientFirstName = strName;
         ViewBag.Employee = strEmployee;


           return View();
     }
Posted

1 solution

Please Specify the controller and ActionResult and then Try
http://localhost:49224/Controller/Action?Name=L%20Dube&Employee=ANAR3701[^]
Hope this helps
 
Share this answer
 
Comments
P.C Shabangu 6-Sep-13 2:46am    
thanx Jameel this does work, but what if I want to display the same information on a different View which is called by a different Controller?
Jameel VM 6-Sep-13 4:50am    
post it as a separate question by eloborating your requirement.Ofcouse will help you.

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