Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

get asp.net session variable in HTML

Posted on 2011-03-23
12
Medium Priority
?
494 Views
Last Modified: 2012-05-11
I am trying to do:

<asp:HyperLink ID="hlMainImageView2"
                                             runat="server" ImageUrl=Session.BaseUrl &  UploadedImages/">View</asp:HyperLink>

Where session is my attempt to get the value of the session BaseUrl as use it has part of the hyperlink
0
Comment
Question by:vbnetcoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35201983
try:
<asp:HyperLink ID="hlMainImageView2"
                                             runat="server" ImageUrl=<%Session.BaseUrl%>UploadedImages/">View</asp:HyperLink>

0
 

Author Comment

by:vbnetcoder
ID: 35202382
It gives me this error:

If this attribute value is enclosed in quotation marks, the quotation marks must match.
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35202391
missing a starting quote for the ImageURL attribute:

<asp:HyperLink ID="hlMainImageView2"
                                             runat="server" ImageUrl="<%Session.BaseUrl%>UploadedImages/">View</asp:HyperLink>

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:vbnetcoder
ID: 35202510
I did this

<br />
<asp:HyperLink ID="HyperLink4"
                                             runat="server" navigateurl="<%Session.BaseUrl%>UploadedImages/100-Main.jpg">View</asp:HyperLink>

AND IT navigated to

http://localhost:52803/MyAPP/products/%3C%Session.BaseUrl%%3EUploadedImages/100-Main.jpg

It did not give me the value for BaseUrL

also /products should not be int the path



0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35202584
ok try this :

<asp:HyperLink ID="HyperLink4"
                                             runat="server" navigateurl="~/<%=Session.BaseUrl%> UploadedImages/100-Main.jpg">View</asp:HyperLink>

note <% has change to <%=

0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35202596
sorry i got that wrong , try :

<asp:HyperLink ID="HyperLink4"
                                             runat="server" navigateurl="<%=Session.BaseUrl%> UploadedImages/100-Main.jpg">View</asp:HyperLink>

0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35202621
ok what about :
<asp:HyperLink ID="HyperLink4"
                                             runat="server" navigateurl=<%=Session.BaseUrl%> & UploadedImages/100-Main.jpg>View</asp:HyperLink>

0
 

Author Comment

by:vbnetcoder
ID: 35202632
IT does not render. IT tells me that the server tag is not well formed
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 2000 total points
ID: 35202650
Actually how about you do this instead :

<asp:HyperLink ID="HyperLink4"
                                             runat="server" navigateurl="~/UploadedImages/100-Main.jpg">View</asp:HyperLink>

0
 

Author Comment

by:vbnetcoder
ID: 35202664
That worked!

Thank you
0
 

Author Closing Comment

by:vbnetcoder
ID: 35202676
ty
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question