MVC Controller Action Gets Called Multiple Times

sam
sam
134 Points
62 Posts

Hi,

I am working with MVC 5. I am facing strange problem where a controller action is called at least twice some time more than. Also I have tried by direct accessing through typing in browser but same problem occurred.

What will be the problem?

Thanks in advance.

Views: 9006
Total Answered: 2
Total Marked As Answer: 0
Posted On: 23-Jan-2016 05:52

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1172 Points
211 Posts
         

Some time Controller Action Gets Called Multiple Times for following reason:

  • if view or layout page has img tag with src="#" 
  • if view or layout page has anchor tab with href="#"

In above both case an action get called multiple times. You have to remove the tag or put src or href or blank it.

Posted On: 28-Jan-2016 02:44
beginer
beginer
84 Points
32 Posts
         

I also faced same issue. The Action was rendering multiple times. The only problem was with

<img id="image1id" src="#" alt="your image" />

Don't know for what reason src attribute of image was causing to perform rendering multiple times on page. I just changed it to ""`

<img id="image1id" src="" alt="your image" />

and it is working fine now.

Posted On: 28-May-2018 00:43
 Log In to Chat