Solved

How to add Response.Write line in ASP?

Posted on 2011-09-16
5
436 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

807 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