0

I know this is a common issue, but I have tried so many things and I just cannot figure this out. I am generating two links:

http://localhost:1757/ViewReport/DeleteFileFromServer?id=orderedList2.png&reportid=3f66320f-a092-4c5e-8321-3a0b6def68c2
http://localhost:1757/ViewReport/Downloading?id=orderedList7.png&reportid=3f66320f-a092-4c5e-8321-3a0b6def68c2

And am attempting to trigger the underlying controller from these 2 urls. My routeconfig has one entry in it, which is the default one:

    routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional}
            );

And my two controller functions are:

  [HttpGet]
    public void Downloading(string id,string reportid){//code}
[HttpGet]
    private void DeleteFileFromServer(string id, string reportid){//code}

Downloading gets called when using its url, but DeleteFileFromServer NEVER gets called, even though they have almost an identical url except for the controller name. There is NO special entry in route config, so I cannot figure this out. Any ideas? Thank you.

1
  • 1
    Make the deletefilefromserver method public. Commented Aug 5, 2013 at 16:54

2 Answers 2

4

DeleteFileFromServer is marked private. Make it public.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I feel like an idiot. One of those mind numbing days where you think it is something far more complicated than it actually is. Thanks!
2

Look at the scope of the methods, one is private and the other is public, both should be public

[HttpGet]
public void Downloading(string id,string reportid){//code}
[HttpGet]
public void DeleteFileFromServer(string id, string reportid){//code}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.