Solved

How to add Response.Write line in ASP?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ajax control editor 4 60
ASP CDO - Limiting Connections 2 36
JavaScript: Issue with onClick 5 34
Split in Javascript 5 30
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

914 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

12 Experts available now in Live!

Get 1:1 Help Now