Am writing a custom rewrite provider for IIS to send users to different sites depending on whether certain criteria are met. So if the user meets the criteria, the url does not get rewritten and the user can proceed as normal. If the user does not meet the criteria the url gets rewritten to load a different site, whilst appearing to be on the same url.
If set the rewrite section of the provider up like so the url is unaffected and the user is sent to the site as expected.
public string Rewrite(string value)
{
return value;
}
If set the rewrite section of the provider up like so the url is rewritten and the user is sent the alternate site.
public string Rewrite(string value)
{
return alternateSite;
}
If however I use the following set up if the user does not match the criteria they end up in the alternate site as expected. However if they do meet the criteria they end up in a redirect loop.
public string Rewrite(string value)
{
string newVal = alternateSite;
if (user != null)
{
if (user.status == 1)
{
newVal = value;
}
}
return newVal;
}
Any ideas how I can prevent this loop and have the site load correctly.
Thanks
EDIT Still no joy with this. I suspect if I could make the provider not perform the rewrite if the user meets the credentials (equivalent to setting the action to none on a standard rewrite rule) then it should continue to load normally. However I have no idea how to do this.