MVC Controller Action Gets Called Multiple Times

sam
sam
Member
378 Points
48 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: 19027
Total Answered: 2
Total Marked As Answer: 1
Posted On: 23-Jan-2016 05:52

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 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
Member
1328 Points
43 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