am writing custom rewrite provider iis send users different sites depending on whether criteria met. if user meets criteria, url not rewritten , user can proceed normal. if user not meet criteria url gets rewritten load different site, whilst appearing on same url.
if set rewrite section of provider url unaffected , user sent site expected.
public string rewrite(string value) { return value; } if set rewrite section of provider url rewritten , user sent alternate site.
public string rewrite(string value) { return alternatesite; } if use following set if user not match criteria end in alternate site expected. if meet criteria end in redirect loop.
public string rewrite(string value) { string newval = alternatesite; if (user != null) { if (user.status == 1) { newval = value; } } return newval; } any ideas how can prevent loop , have site load correctly.
thanks
edit still no joy this. suspect if make provider not perform rewrite if user meets credentials (equivalent setting action none on standard rewrite rule) should continue load normally. have no idea how this.
the problem provider setting variables provider when initialized, either or being cached. these values being used multiple sessions on multiple calls. fine constant connection string not user id stored in cookie. instead sent user id through part of rewrite , split out out in provider logic part of rewrite so:
in iis {myprovider:{url}+{http_cookie}}
in provider
public string rewrite(string value) { string[] values = value.split('+'); string requesturl = values[0]; string cookiestr = ""; if (values.length > 1) { cookiestr = values[1]; } ... this forces provider fresh data each time , redirects go supposed to.
hope useful someone
Comments
Post a Comment