How does asp.net WebService remove the asmx suffix and webserviceasmx?

Source: Internet
Author: User

How does asp.net WebService remove the asmx suffix and webserviceasmx?

There is now a published WebService with the address http://hovertree.com: 2706/UploadExpenseToConstract. asmx
Can I remove the final asmx? Change
Http://hovertree.com: 2706/UploadExpenseToConstract
But the effect is the same as the original one?

Code:
Global. asax

using System;namespace ExampleHoverTree{    public class Global : System.Web.HttpApplication    {        protected void Application_Start(object sender, EventArgs e)        {        }        protected void Session_Start(object sender, EventArgs e)        {        }        protected void Application_BeginRequest(object sender, EventArgs e)        {            string hPath= Request.Url.LocalPath.ToString().ToLower();            if (!hPath.Contains("/hovertreewm.asmx"))            {                if (hPath.Contains("/hovertreewm"))                {                    Context.RewritePath(hPath.Replace("/hovertreewm", "/hovertreewm.asmx"));                }            }        }        protected void Application_AuthenticateRequest(object sender, EventArgs e)        {        }        protected void Application_Error(object sender, EventArgs e)        {        }        protected void Session_End(object sender, EventArgs e)        {        }        protected void Application_End(object sender, EventArgs e)        {        }    }}

HoverTreeWM. asmx

Using System. web. services; namespace ExampleHoverTree. htExample. HWebMethod {// <summary> // summary of HoverTreeWM /// </summary> [WebService (Namespace = "http://hovertree.top/")] [WebServiceBinding (ConformsTo = WsiProfiles. basicProfile1_1)] [System. componentModel. toolboxItem (false)] // to allow ASP.. net ajax calls this Web service from a script. uncomment the following lines. By he asked [System. web. script. services. scriptService] public class HoverTreeWM: System. web. services. webService {[WebMethod] public string HLogin (string hUsername, string hPassword) {// return hUsername + hPassword; return (hUsername. toLower () = "hewenqi" & hPassword = "HoverTree ")? "Logon successful": "incorrect user name or password ";}}}

HoverTreeAjax.htm

<! DOCTYPE html> 

:

Source code download: http://hovertree.com/h/bjaf/hv6cqe5n.htm

Recommended: http://www.cnblogs.com/sosoft/p/csharpemail.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.