Call web page method in WCF Web Service using C# in ASP.Net

Last Reply 11 months ago By Mudassar

Posted one year ago

I have login.aspx

in code behind file i have method Validate(Email) with in same project i created a SVC .

Now how to call the Validate(Email) method which is in login.aspx code behind file.

my requirement is client application should call WCF service.

WCF should call a method which is in code behind file a webpage . is this possible?

Posted one year ago
Mahesh1986 says:
But that WCF should call a method which is in code behind file a webpage . is this possible?

 This is not possible. A WCF Web Service cannot call a Web Page


Posted 11 months ago

But that's not best practice. As ASP Pages are not meant to be called like that.

It is a Partial Class. You should create a new Class say GeneralMethods.cs and in that keep all methods that you want to use in your Projects.

public static class GeneralMethods
{
      public static bool ValidateEmail(string email)
      {
              //Code goes here.
      }
}

To use

bool isValid = GeneralMethods.ValidateEmail("a@a.com")