Assigning a MVC Controller property from Asp.Net page

Posted by JasonMHirst on Stack Overflow See other posts from Stack Overflow or by JasonMHirst
Published on 2010-03-23T10:28:45Z Indexed on 2010/03/24 19:23 UTC
Read the original article Hit count: 279

Filed under:
|

I don't know if I've understanding MVC correctly if my question makes no sense, but I'm trying to understand the following:

I have some code on a controller that returns JSON data. The JSON data is populated based on a choice from a dropdown box on an Asp.Net page. I thought (incorrectly) that Session variables would be shared between the Asp.Net project and the MVC Project. What I'd like to do therefore (if this is possible), is to call a Sub on the MVC that sets a variable before the JSON query is run.

I have the following:

Sub SetCountryID(ByVal CountryID As Integer)
    Me.pCountrySelectedID = CountryID
End Sub

Which I can call by the following:

Response.Write("http://localhost:7970/Home/SetCountryID/?CountryID=44")

But this then results in a blank page - again obviouslly totally incorrect!

Am I going about MVC the wrong way or do I still have a hell of a lot more learning to do?

Is this even possible to do?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc