Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <rewrite>
- <rules>
- <rule name="GetEnvironmentInfo">
- <match url=".*" />
- <serverVariables>
- <set name="Environment" value="Dev" />
- </serverVariables>
- <action type="Rewrite" url="{R:0}" />
- </rule>
- </rules>
- </rewrite>
- string output = string.Empty;
- if (Request.Properties.ContainsKey("MS_HttpContext"))
- {
- output = ((System.Web.HttpContextWrapper)Request.Properties["MS_HttpContext"]).Request.ServerVariables["Environment"];
- }
- else if (Request.Properties.ContainsKey("MS_OwinContext"))
- {
- var httpContextWrapper = ((OwinContext)Request.Properties["MS_OwinContext"]).Environment["System.Web.HttpContextBase"] as HttpContextWrapper;
- output = httpContextWrapper.Request.ServerVariables["Environment"];
- }
Advertisement
Add Comment
Please, Sign In to add comment