private void HandleBeginRequest(object sender, EventArgs e)
        {
            InvoiceMakerApplication ima = (InvoiceMakerApplication)sender;
            string path = ima.Context.Request.Path;

            if (path.StartsWith("/api/hash/"))
            {
                string text = path.Substring(10);
                text += ".hash";
                ima.Context.RewritePath(text);
            }
            else if (path.StartsWith("/api/binhash/"))
            {
                string text = path.Substring(13);
                text += ".binhash";
                ima.Context.RewritePath(text);
            }
        }
Exemplo n.º 2
0
        private void HandleBeginRequest(object sender, EventArgs e)
        {
            InvoiceMakerApplication application = sender as InvoiceMakerApplication;
            HttpContext             context     = application.Context;
            HttpRequest             request     = context.Request;
            Uri    uri          = request.Url;
            string absolutePath = uri.AbsolutePath;
            string newPath      = "/";

            if (absolutePath.StartsWith("/api/hash/"))
            {
                newPath += $"{absolutePath.Substring(10)}.hash";
                context.RewritePath(newPath);
            }
            else if (absolutePath.StartsWith("/api/binhash/"))
            {
                newPath += $"{absolutePath.Substring(13)}.binhash";
                context.RewritePath(newPath);
            }
        }