Solved

How to add Response.Write line in ASP?

Posted on 2011-09-16
5
433 Views
Last Modified: 2012-05-12
Dear EE experts,

I'm not sure for the title of my thread on how to ask it. But I would like to ask for tech support on how to add this Response.Write line in ASP...

Please see the attached screenshots & codes,
The first image is the screenshot of before user logins & inside of that page, the first code is included...

What I want to happen is to add a link (that is hidden if user hasn't login yet, and will show if the user login = true), on the right column beside the "REGISTERED USERS".

I tried to put & use the 2nd code on that space, but it gives me a 500 Internal Server error... and everytime I remove that code, it returns to it's normal state...

This hidden link will be shown when the user logs in & if the user clicks it, it'll redirect the user to the upload page, so I need to put the it's path location as well...

That would be all & hope to hear soon...
* First code:
------------------------
<%
   '// If user is logged in show name and logout link
   If Session("loggedin") = true Then
      Response.Write "Welcome: " & Session("name")
      Response.Write "<br /><a href=""../asia/login2/logout.asp"">Logout</a>"
   Else
      Response.Write "<a href=""ste-iphoto-login.asp"" title=""CLICK TO LOGIN"">REGISTERED USERS</a>"
   End If
%>
----------------------------------
2nd code:
<%
   If Session("loggedIn") = true Then
   Response.Write "<a href=""" & rsProducts("iDownload") & """>DOWNLOAD</a>"
   End If
%>

Open in new window

1st-img.jpg
after-login.jpg
0
Comment
Question by:Stiebel Eltron
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 36550719
Where are you setting: rsProducts("iDownload")?
0
 

Author Comment

by:Stiebel Eltron
ID: 36550791
It is connected to a db. But how if I will change that "rsProducts("iDownload")" by a link that will direct a user to the Upload Page, another page... That will only show the link "UPLOAD" if the user logs in...
0
 
LVL 28

Accepted Solution

by:
strickdd earned 500 total points
ID: 36550860
I would recommend finding what part of that code is causing the 500 error. Easiest way is to remove everything and slowly add it back in until the error occurs:

Step 1:
<%
   If Session("loggedIn") = true Then
   'nothing
   End If
%>

Step 2:
<%
   If Session("loggedIn") = true Then
   Response.Write "Test"
   End If
%>

Step 3:
<%
   If Session("loggedIn") = true Then
   Response.Write "<a href="""">DOWNLOAD</a>"
   End If
%>

Step 4:
<%
   If Session("loggedIn") = true Then
   Response.Write "<a href=""" & Session("loggedIn") & """>DOWNLOAD</a>"
   End If
%>

If any of these steps fail, we need to figure out why. If none of them fail, then the problem is using the rsProducts object.
0
 

Author Comment

by:Stiebel Eltron
ID: 36558092
Everything works! Great!

I just add the link here:
<%
   If Session("loggedIn") = true Then
   Response.Write "<a href=""http://"">UPLOAD</a>"
   End If
%>

It's working so it means that I did correct :-)
0
 

Author Closing Comment

by:Stiebel Eltron
ID: 36558094
Excellent!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

762 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now