Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have one solution_Prj and under soluations having 4 projects( BALLibrary,DALLibrary,Entity,WebProject1)

in WebProject1 add one web services successfully added in my webproject1. my web sesrvies name webservices.asmx. my question is how to add webservies.cs class in App_code with webservices(logo).

In new website
automatically generate webservices.cs class in app_code. so how to generate webservices.cs class in app_code folder using WebProject

please help me

thanking u
Posted

1 solution

Hi,

generally, if you add a service project, it will ask to add it in app_code folder, so, it did'nt asked, its fine. you just add one class file to the web application, that will create in app_code folder.

inherit that class with "Service" class and add necessary web service attributes to that like below.
C#
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class Class1 : System.Web.Services.WebService
{
    public Class1()
    {    	
    }
}


and modify the code behind and class attributes in asmx files like below.
HTML
<%@ WebService Language="C#" CodeBehind="~/App_Code/Class1.cs" Class="Class1" %>


hope it helps.
 
Share this answer
 
v2
Comments
ritesh_664 18-Jan-18 5:42am    
Sir i have managed all webpages in different folders so how can i call service1.cs from App_code folder

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900