hi ,
i have one problem.
i am using lDap forms authentication in my application,
i have three pages, logon.aspx
login.aspx
webform.aspx
first user run the application ,its first check the user have the valid ipaddress,
if they have valid ipaddress it redirect to webform.aspx page
unless it goes to login.aspx page
below my coding:
web.config: </pages>
<authentication mode="Forms">
<forms loginUrl="logon.aspx" name="adAuthCookie" timeout="10" path="/">
</forms>
</authentication>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetCustomerIP();
if (Request.Params["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage("login.aspx", false);
}
}
}
[WebMethod]
public void GetCustomerIP()
{
string ipaddress = "172.16.107.192";/
/here i hotcode the ipaddress,this ipaddress not match to the below regex Match mm = Regex.Match(ipaddress, "^(((1[0-9]{1,2}))\\.){3}(([0-5]{3,3}))$");
if (mm.Success)
{
string strUname = "";
strUname = WindowsIdentity.GetCurrent().Name.ToString();
Label1.Text = "User Name : " + strUname.ToString();
strUname = strUname.Replace("\\", ",");
string[] Uname = strUname.Split(',');
if (Uname[0].ToString() == "MARG")
//if (Uname[0].ToString() == "PRAGASHLAB")
{
hdnDomain.Value = Uname[0].ToString();
hdnUname.Value = Uname[1].ToString();
ModalPopupExtender1.Show();
}
//Response.Write(ipaddress);
//Response.Redirect("LoginForm.aspx");
}
else
{
Response.Redirect("login.aspx");
}
}
in this code i use hotcode for ipaddress,but the ipaddress not match to the regex
so it goes to the else part that is redirect to the login.aspx page,
but in my code it doest redirect,
defaulty its redirect to the start page of application.
Here i can get the Returnurl but it not goes to the loginpage
Thanks in advance...........
Regards
Kavi.n