开发者

How I can hide url

开发者 https://www.devze.com 2022-12-31 09:12 出处:网络
void Application_BeginRequest(Object sender, EventArgs e) { HttpApplication app = sender as HttpApplication;
    void Application_BeginRequest(Object sender, EventArgs e)
    {
        HttpApplication app = sender as HttpApplication;
        if (app != null)
            if (app.Request.AppRelativeCurrentExecutionFilePath == "~/About.aspx")
                app.Context.RewritePath(
                    app.Request.Url.PathAndQuery.Replace("/About.aspx", "")
                );
    }

I want to hide url like the following :

requested url : "http://domain.com/WebFolder/page.aspx"

url should be show : "http://doma开发者_StackOverflow中文版in.com/WebFolder"

The above code is not producing my desired result. It's causing to redirect new rewrite page. I don't want that, I just want to hide my url for section of page name.


You can use the IIS URL Rewrite module.


I have two ways to accomplish this in mind.

One is making your page a default page under IIS.
To do this,you should select Properties page for your folder WebFolder under IIS then select default page ( default is index.html ) to your page (page.aspx),then make it top page.

Second is ISAPI Rewriting which is more useful.It is a free .dll.Look at this site for more information.

Hope this helps
Myra

0

精彩评论

暂无评论...
验证码 换一张
取 消