Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've following page code:-

XML
<li><a href="perloan.aspx">Personel Loans</a></li>
                    <li><a href="homloan.aspx">Home Loans</a></li>
                    <li><a href="lap.aspx">Loan Against Property</a></li>
                    <li><a href="autloan.aspx">Vehicle Loans</a></li>
                    <li><a href="">Education Loans</a></li>
                    <li><a href="">Business Loans</a></li>
                    <li><a href="">Loan Against Gold</a></li>
                    <li><a href="">Expert Advice</a></li>



Now I want for every empty (a href) link tag. It should be redirected to fd.aspx page.
I tried the following code in web.config:-

XML
<configuration>
  <system.webServer>
    <httpRedirect enabled="true" destination="www.paisamarket.com/fd.aspx" exactDestination="true" httpResponseStatus="Permanent" />
  </system.webServer>
  <location path="fd.aspx">
    <system.webServer>
      <httpRedirect enabled="true" />
    </system.webServer>
  </location>
    <appSettings>
        <add key="str" value="data source=DEEPAKSHARMA-PC\SQLEXPRESS; initial catalog=new; integrated security=true"></add>
    </appSettings>
</configuration>



But it's not working. Please help me..........
Posted
Updated 7-Jul-15 16:45pm
v2

1 solution

Hi,

currently you are re-directing to fd.aspx destination path if being checked for fd.aspx.


For page not found error redirection, try this.

XML
<customErrors mode="RemoteOnly" defaultRedirect="~/GeneralError.aspx">
     <error statusCode="404" redirect="~/PageNotFound.aspx"/>
   </customErrors>



For all other errors, it redirects to general error page.
For 404 error it redirects to pagenotfound.aspx page.

hope this helps.

Happy coding!
 
Share this answer
 
Comments
Deepak Kanswal Sharma 8-Jul-15 11:09am    
I've tried that code . But it's not working.
I'm giving blank links . Is it creating a problem?
manognya kota 10-Jul-15 3:16am    
Are you sure it is giving only 404 error ?
Check what status code page is displayed on that action.Add the redirect for that status code.
Hope this helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900