Link to home
Start Free TrialLog in
Avatar of nr III
nr III

asked on

Creating a "dynamic" web page:

I need some help creating a "dynamic" web page.
I know some html but here I would like to do
something that I don't know about.

I'm using a NT Server with IIS.

I have a web page today that is the same for four of our customers. I have created four different NT accounts
(The customers have different accounts but it's the same web page.). It's only one page (default.html).

Now I want one part of the web page (default.html)
to be dependent on the login.

Something like this.

<p align="center"><a href="../" & LoginName & "/" & LoginName & ".xls"><font face="Arial"><strong>Text & LoginName</strong></font></a></p>

This means.

Text shown:
A text - string that is the same for all customers.
Then the login name.

Link:
One level back.
A directory with the same name as the login name.
An Excel - file with the same name as the login name.

It doesn't matter if I'm using html, java, asp or whatever,
as long as it works on IIS.
Avatar of josefs
josefs

Do you can use asp files ?

example:
<p align="center"><a href="../" & <%=LoginName%> & "/" & <%=LoginName%> & ".xls"><font face="Arial"><strong>Text & <%=LoginName%></strong></font></a></p>  
Avatar of nr III

ASKER

I can't get it work.
I put the code in an asp - file
located on the IIS - Server.

When I open the web - page in IE i only se "Text & ".
When I take "View Source" this is what I see.

<p align="center"><a href="../" &  & "/" &  & ".xls">
<font face="Arial"><strong>Text & </strong></font></a></p>

It's like IIS doesn't understand
the <%=LoginName%> and the &.

It's quite urgent. Therefore I increase the points.
You also need to put

<%@ Language=VBScript %>

At the top of the file and give it an asp extension.

Did you set up your server, or has it been set up for you?
Avatar of nr III

ASKER

<%@ Language=VBScript %> doesn't help.
Could I please have a complete simple asp page,
with

<%@ Language=VBScript %>

and

<p align="center"><a href="../" & <%=LoginName%> & "/" & <%=LoginName%> & ".xls"><font face="Arial"><strong>Text & <%=LoginName%></strong></font></a></p>

included.

I havn't set up the server myself.
It's been set up for me.
We're using IIS 4.0.
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<a href="../<% = Request.ServerVariables("AUTH_USER") %>/<%=Request.ServerVariables("AUTH_USER")%>.xls">Text & <%=Request.ServerVariables("AUTH_USER")%></a>
<P>&nbsp;</P>

</BODY>
</HTML>

Make sure you have Basic or Challenge/Response security turned on for the directory this page is in.
ASKER CERTIFIED SOLUTION
Avatar of moehler
moehler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nr III

ASKER

It works now but there is one problem.

<% = Request.ServerVariables("AUTH_USER") %>

returns not only the "LoginName" but "ServerName\LoginName".

Is there a way around that problem?

You could try the following

StrUser = "aegonusa\moehler"
strUserName = right(strUser,len(strUser)-InStrRev(strUser,"\"))

then user strUserName for the logon name.
You could try the following

StrUser = "aegonusa\moehler"
strUserName = right(strUser,len(strUser)-InStrRev(strUser,"\"))

then user strUserName for the logon name.
You could try the following

StrUser = "aegonusa\moehler"
strUserName = right(strUser,len(strUser)-InStrRev(strUser,"\"))

then user strUserName for the logon name.
Oops. looks like I kept my testing values in the last code snippit. It should be...

strUser = request.serverVariables("Auth_User")

...I hate it when I do that.
Did that resolve your issue?
Avatar of nr III

ASKER

I'm sorry for letting you wait.
I've had som more urgent problems to solve
(a crashed mail - database). Now I'm back
working on this little web - project.

I did some testing before I got your comments.

I tried to disable (unmarked)
"Basic or Challenge/Response security"
in the IIS for this directory.

It was unmarked from the start.
Then I marked it as you told me.
I didn't understand what it did so I wanted
to know what would happen if I unmarked it.

That did very unexpectedly (for me) solve my problem.
(I expected that the page wouldn't work at all.)

Could you please explain this?
If you mean why it didn't work when you unchecked basic and challenge/response it is because the browser then hits the web server as an anonymous user and therefore doesn't pass any user information at all. This is because it doesn't need to and/or have the information to pass.

Glad to hear the page is working.
Avatar of nr III

ASKER

Thanks for your help.