Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello to everyone:
Can someone help me? I need to get the value in server side from href when is click , example click on "GO A",get "~/webforms/aaaa.aspx" and pass to server side
ASP.NET
<ul  runat="server" id="options" class="nav">
 <li class="dropdown">
   <a id="aaaa"  runat="server" href="~/webforms/aaaa.aspx" title="Inicio">GO A</a>
 </li>
 <li class="dropdown">
   <a id="bbbbb"  runat="server" href="~/webforms/bbbbb.aspx">GO B </a>
 </li>
 <li class="dropdown">
   <a iid="cccccccc"  runat="server" href="~/webforms/cccccccc.aspx">GO C </a>
 </li>
 <li class="dropdown">
   <a id="dddddd"  runat="server" href="~/webforms/dddddd.aspx">GO D</a>
 </li>
</ul>

How can I do this?
Thanks
Posted
Comments
Philippe Mori 3-Jun-15 12:12pm    
If you have a link rhen the server will be called with that link and the corresponding page will open. You don't have anything to do to pas the value.
Hanss1492 3-Jun-15 12:30pm    
I know when is click is called the method and Open the corresponding page,I just need the value href because I have roles and a function in a Class who validate if have permission for the webforms, im doing this in MasterPage because theres is a lot of webforms
Philippe Mori 3-Jun-15 13:17pm    
In master page, you should not need to use the address for permission validation. If you do, then your design is discuttable and it will be hard to maintain.
Sergey Alexandrovich Kryukov 3-Jun-15 12:27pm    
Not clear. When you send any HTTP request to the server, it always get at least one link: the request URL.
What link do you need to pass and why? Where did you get the code sample you show? Isn't it already deployed on the site (or to be deployed)? Then all href attribute in your sample are already in the server side.
—SA
Hanss1492 3-Jun-15 12:39pm    
Yes sergey you are right, sorry for not be clear I just whant to get the href value in server side before enter the new page to validate permission and others things, but I get the solution trying another way, anyway really thanks for explanation

1 solution

The HttpRequest class[^] has various properties to read the path of the current request.

For example, the AppRelativeCurrentExecutionFilePath property[^] will give you the app-relative path for the current page - eg: "~/webforms/aaaa.aspx".
 
Share this answer
 

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



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