1

Is it possible for a Webforms class to call an MVC2 action controller that returns a string?

My Webforms class is a proxy class for an external webservice, and so I have no JavaScript code - the properties thatI need must be retrieved in the code-behind!

The proxy class is in use by other projects in my solution, so I preferably do not want to move it into the MVC project. The proxy gathers a few properties, among them the full path to a PDF.

The PDF has not yet been generated when the proxy needs it, and the responsibility of generating it lies on the MVC project. Because of this, I need to call an action controller that generates a PDF and returns its path.

2 Answers 2

1

You shouldn't really mix webforms and MVC. Better to put them in separate apps & communicate via HTTP/REST/SOAP, etc.

If it's an external web service, can you not add it again to your MVC app?

If you can't modify the proxy at all, then add a webforms page to your mvc app & have it inherit from the proxy. create the controller & action to create the pdf the redirect back to the webform.

Simon

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

4 Comments

Are there no alternatives to using HTTP/REST/SOAP? I want to avoid adding another project to the solution if I can. There's numerous other webforms projects that use the proxy, so I do not want to move it to the MVC project.
It depends on what the proxy is doing. Without further information it's hard to provide a solution. Can you describe what the proxy does in more detail?
Added a more detailed solution
Thanks for your answer! Unfortunately I do not want to bring any knowledge of the proxy into the MVC project. I found another solution.
0

The solution that worked for me was to use the WebRequest class, which MSDN has a good article on here: How to: Send Data Using the WebRequest Class

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.