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

Last Reply one year 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?

You are viewing reply posted by: Mudassar one year ago.
Posted one year 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")