Click here to Skip to main content
12,297,838 members (53,222 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# 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 2:50am
tusDev1336

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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2016
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