Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Ajax C#4.0 MVC Razor
Hi,
 
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.
 
Thanks.
Posted 10-Oct-12 3:50am
tusDev1332

1 solution

Rate this: bad
good
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"
 
Try:
@using (Html.BeginForm("Login", "Home", FormMethod.Post, new { data_ajax = "false" }))
  Permalink  
Comments
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 7,215
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2014
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