user2641353 user2641353 - 8 months ago 67
ASP.NET (C#) Question

redirect url using web config

I have two projects with localhost: 8001 and localhost: 8100.
In both projects I have links where I call other project like

<ul class="dropdown-menu" role="menu">
<li><a href="http://localhost:8001/Myprofile">My profile</a></li>
<li class="divider"></li>
<li><a href="http://localhost:8001/MyProjects">My projects</a></li>
<li class="divider"></li>
<li><a href="http://localhost:8001/MyHolidays">My holidays</a></li>

The problem is that I need to config this in web config so I don’t use localhost: 8001 or localhost: 8100 in url but I don’t know how.
I hope that you understand my problem and can help me.


In web.config under app.Settings you can keep them this way:

<add key="Application1" value="http://localhost:8001/"/>
<add key="Application2" value="http://localhost:8100/"/>    

and in View:

<a href='@(System.Configuration.ConfigurationManager.AppSettings["Application1"] + "MyProfile")'>My Profile </a>