Forums - C# Corner

Forum guidelines
Harish Batchu

Harish Batchu

  • 1.6k
  • 118
  • 1.6k

When i apply url rewriting it does not going to other page?

Nov 6 2018 3:02 AM
 
I have login and registration panel in master page and when click on login page to checking the user i am using the ajax call and same to the registration page. but when applying rewrite the url rules inside the web.config file it's does't working.
 
This code i applied for url rewriting inside web.config file
------------------------------------------------------------------------
<rewrite>
<rules>
<rule name="RemoveASPX" enabled="true" stopProcessing="true">
<match url="(.*)\.aspx" />
<action type="Redirect" url="{R:1}" />
</rule>
<rule name="AddASPX" enabled="true">
<match url=".*" negate="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{URL}" pattern="(.*)\.(.*)" negate="true" />
</conditions>
<action type="Rewrite" url="{R:0}.aspx" />
</rule>
</rules>
</rewrite>
 
 
in master page when click on button through ajax call it's not working
 
this code i write when click on button
$("#loginbtn").click(function (e) {
var email = $("#username");
var password = $("#password1") ;
if (email.val() != '' && password.val() != '')
{
var email = $("#username").val();
var password = $("#password1").val();
//This is the data i am sending to webmethod
//var dataList = "{ 'Name':'" + name + "','State':'" + password + "'}";
$.ajax({
type: "post",
dataType: "json",
contentType: "application/json; charset=utf-8",
url: "Incomeexpenses.aspx/SaveDetails",
data: "{'Name':'" + email + "', 'Password':'" + password + "'}",
success: function (data, textStatus) {
if (data.d == "true") {
location.href = "UInvestm.aspx";
} else {
alert("failed");
}
}
});
}
else{
alert("username and password should enter")
}
});