asp.net mvc - HttpContext.Request.RawUrl and localhost -
i have authorizeattribute checks user logged in, , if not, redirects user login page.
i want include returnurl while redirecting login page. currently, use filtercontext.httpcontext.request.rawurl obtain current url.
the problem when host app on iis, example http://localhost/testapp1
, try access it, within authorizeattribute, filtercontext.httpcontext.request.rawurl return /testapp1 instead of /, incorrect.
is there solution obtain correct relative path when app hosted on local iis?
you can want this:
string applicationpath = filtercontext.httpcontext.request.applicationpath; string returnurl = filtercontext.httpcontext.request.rawurl.replace(applicationpath, "");
Comments
Post a Comment