Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Ajax C#4.0 MVC Razor
I am developing a mobile website in MVC4 (using Razor view Engine).
The issue I am facing is that When I navigate to different View using RedirectToAction() method, the new view is served but the URL remains the same in the browser.
I searched about it and found that If I disable the AJAX on my page (by setting attribute [data-ajax=false]) then It start working fine(i.e. correct URL is displayed). But Ajax stops working.
But my problem is that I can not disable AJAX for mobile website & I need to display correct URL for each page.
Please help if you can asap.
Posted 10-Oct-12 3:50am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

May be you can try to sent the submit/redirect code call as non-ajax using data_ajax = "false"
@using (Html.BeginForm("Login", "Home", FormMethod.Post, new { data_ajax = "false" }))
tusDev1 at 10-Oct-12 23:54pm
Hi Sandeep,
Thanks, I have tried this. But my problem is that I have to use AJAX, when I use your suggestion it stops the AJAX on page.
Any Ideas how to achive correct URL display in AJAX?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 476
1 Sergey Alexandrovich Kryukov 235
2 CHill60 195
3 Afzaal Ahmad Zeeshan 145
4 TheRealSteveJudge 120
0 Sergey Alexandrovich Kryukov 9,121
1 OriginalGriff 7,920
2 Peter Leow 4,774
3 Kornfeld Eliyahu Peter 3,210
4 Maciej Los 2,176

Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100