Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to change the url for an MVC project. Code running in partial views stores user data in the session.
When I change the IIS Express url from http://localhost:65000/ to http://localhost:65000/test, other partial views which saw the session variable see it as null. If I change the url back, it works fine again.
I assume I'm missing something obvious.

Thanks

What I have tried:

Changed web.config session settings to no effect
Posted
Updated 18-Jul-16 4:56am
Comments
Sunasara Imdadhusen 15-Jul-16 2:48am    
Could you please share little bit of code how you access your session in the app?
rtorkelson 18-Jul-16 14:41pm    
I have replicated the issue with a new MVC project.
The route config default is home index. _Layout.cshtml has the default menu replaced with a partial view into the Menu area MenuController _Menu partialviewresult method which returns a viewmodel containing an unordered list of menu items. This is also Html encoded into the session.
The viewmodel fills an @Html.Raw object in _Menu.cshtml.
_Layout.cshtml has a script which makes an Ajax call from a function in $(document).Ready into the SubMenu method in MenuController where code uses the loaded Session menu for further processing.
In this code the Session menu is populated when the project settings do not have a path after localhost:port in the project url but is null when project url has a value like http://localhost:port/Test

I hope that this description helps clarify my question.

1 solution

Hi, You Need to set starting page in RouteConfig.cs. It is located in App_Data.

In your URL Missing Controller Name.
 
Share this answer
 

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