I have a Visual Studio solution, containing .cs and .vb projects, as well as .aspx files. As usual, the .aspx files implement an ASP.NET site and make calls to the .cs and .vb projects.
Is it possible to do the reverse… i.e. make a call from a .cs or .vb file to a method in a .aspx file? (Assume for the purpose of this question that there is a good reason for doing this)
The code driving your ASPX page is essentially just a class (be it from code-behind or on the aspx file itself), and as such can be instantiated/referenced by other classes which reference that assembly or project. (As Matías pointed out, this may be an issue if you use a “Web Site” instead of a “Web Application” but I generally don’t use the former so can’t help you with that.)
One thing to keep in mind is the exact desired functionality of this function being called…
That second one might get tricky. If the current instance of the page needs to be referenced by the calling class, then that page will need to pass a reference to itself through the chain of method calls that leads to the class which calls the method on the page. Sounds kind of ugly to me.
Can you describe in more detail what functionality you’re attempting to achieve here?