开发者

How I can hide url

    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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜