Harish Batchu

Harish Batchu

  • NA
  • 255
  • 70.2k

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
  1. <rewrite>  
  2. <rules>  
  3. <rule name="RemoveASPX" enabled="true" stopProcessing="true">  
  4. <match url="(.*)\.aspx" />  
  5. <action type="Redirect" url="{R:1}" />  
  6. </rule>  
  7. <rule name="AddASPX" enabled="true">  
  8. <match url=".*" negate="false" />  
  9. <conditions>  
  10. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />  
  11. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />  
  12. <add input="{URL}" pattern="(.*)\.(.*)" negate="true" />  
  13. </conditions>  
  14. <action type="Rewrite" url="{R:0}.aspx" />  
  15. </rule>  
  16. </rules>  
  17. </rewrite>  
in master page when click on button through ajax call it's not working
this code i write when click on button
  1. $("#loginbtn").click(function (e) {  
  2. var email = $("#username");  
  3. var password = $("#password1") ;  
  4. if (email.val() != '' && password.val() != '')  
  5. {  
  6. var email = $("#username").val();  
  7. var password = $("#password1").val();  
  8. //This is the data i am sending to webmethod  
  9. //var dataList = "{ 'Name':'" + name + "','State':'" + password + "'}";  
  10. $.ajax({  
  11. type: "post",  
  12. dataType: "json",  
  13. contentType: "application/json; charset=utf-8",  
  14. url: "Incomeexpenses.aspx/SaveDetails",  
  15. data: "{'Name':'" + email + "', 'Password':'" + password + "'}",  
  16. success: function (data, textStatus) {  
  17. if (data.d == "true") {  
  18. location.href = "UInvestm.aspx";  
  19. else {  
  20. alert("failed");  
  21. }  
  22. }  
  23. });  
  24. }  
  25. else{  
  26. alert("username and password should enter")  
  27. }  
  28. });  

Answers (1)