I used javascript to get around the problem.
My setup is like this:
-Main folder (uses Anonymous access)
--authResponse folder (uses Integrated Windows authentication)
---returncredentials.asp (uses Integrated Windows authentication)
--auth.aspx (uses Anonymous access)
--weblogin.aspx (uses Anonymous access)
--winlogin.asp (uses Integrated Windows authentication) (My project required the use of an asp page. You can use .NET or whatever)
Given below is the code for the pages:
returncredentials.asp
<%
response.expires=-1
response.write(time)
%>
auth.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
// Response.Write(Context.User.Identity.Name);
}
</script>
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
//document.myForm.time.value=xmlHttp.responseText;
//alert(xmlHttp.responseText);
//xmlHttp.responseText
}
}
xmlHttp.open("GET","authResponse/returncredentials.asp",true);
xmlHttp.send(null);
window.location = "winlogin.asp";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body onload="ajaxFunction();">
<form id="form1" runat="server">
<div>
<%-- Name: <input type="text" onkeyup="ajaxFunction();" name="username" />
Time: <input type="text" name="time" /> --%>
</div>
</form>
</body>
</html>
weblogin.aspx
<%@ Page Language="C#" %>
<%@ Import Namespace = "System.Net" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string clientIPAddress = Request.ServerVariables["REMOTE_ADDR"];
string pattern = "10.[1-5].([0-9]|[0-9][0-9]|[0-9][0-9][0-9]).([0-9]|[0-9][0-9]|[0-9][0-9][0-9])";
Regex check = new Regex(pattern);
bool valid = false;
if (clientIPAddress == "")
{
//no address provided so return false
valid = false;
}
else
{
//address provided so use the IsMatch Method
//of the Regular Expression object
valid = check.IsMatch(clientIPAddress, 0);
}
if (valid)
{
Response.Redirect("auth.aspx");
}
else
{
Response.Redirect("default.asp");
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>weblogin</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
winlogin.asp
<%
Dim arrUserInfo, sUserName, sDomainName
arrUserInfo = split(Request.ServerVariables("LOGON_USER"),"\")
sDomainName = arrUserInfo(0)
sUserName = arrUserInfo(1)
Session("suid") = sUserName
Session("domain") = sDomainName
Session("DestPage") = "head.asp"
Response.Redirect(Session("DestPage"))
%>
Basically the page people should be accessing (whether they're on the network or off it) is the weblogin.aspx page. That page then redirects them to the appropriate page. If they're part of the network, they're sent to auth.aspx which is basically an ajax page. That tries to access a Windows Authenticated page (returncredentials.asp) after which the server can now read the username and domain in the form DOMAIN\USERNAME.
winlogin.asp just splits that up and stores it in Sessions. You can obviously do whatever you want in winlogin.asp.