C# Url.Action parameters - Sub application

179 Views Asked by At

I am working on sub application related changes in web app. My web application is optimized to run with or without virtual directory. For that, I met with a condition that checked whether the incoming URL is having "/" or "/{subapplicationname}/"

To check this case I made a condition like below,

HttpContext.Request.Url.AbsolutePath == Url.Action("/", "/")

Without Subapplication: "/" == "/"

With Subapplication: "/applicationname/" == "/applicationname/"

Well actually, both cases (with and without sub application) passed.

And my doubt is whether Url.Action("/", "/") syntax is correct? or else going for HttpRuntime.AppDomainAppVirtualPath is optimal one?

I have searched over internet and didn't find Url.Action("/", "/") scenario.

Any help is appreciated. Thanks in advance.

0

There are 0 best solutions below