Parser Error: The server block is not well formed

A

Assimalyst

Hi,

I have a login/logout application, which works fine using sessions. But
when the user logs out, they can navigate back to the previous page
usng the back button, apparently a perculiar querk of the cache.

The following code should apparently rectify this

<%@ Response.Expires = 0 %>
<%@ Response.ExpiresAbsolute = Now() -1 %>
<%@ Response.AddHeader "pragma", "no-cache" %>
<%@ Response.AddHeader "cache-control", "private" %>
<%@ Response.CacheControl = "no-cache" %>

I have placed this directly after the following line

<%@ Page language="c#" CodeBehind="AddAssess.aspx.cs"
AutoEventWireup="false" Inherits="PDTdb.AddAssess" %>

but when I try to view the page i get the following error:

"Parser Error: The server block is not well formed"

and the first line <%@ Response.Expires = 0 %> is highlighted.

Any idea what the problem is?

Thanks.
 
B

Brock Allen

Change:
and the first line <%@ Response.Expires = 0 %> is highlighted.

To:

<% Response.Expires = 0; %>

As KArl said, remove the @, but also note the semicolon.
 
A

Assimalyst

Thanks guys,
Thats solved the problem for the first two lines, i'd tried a few
combinations of < and @ etc, but it seems it needed the ;.

Still having trouble with the third line though. I've applied Brock's
idea to all the lines, but now the third is highlighted with the
following error:

Compilation error: CS1002: ; expected

any suggestions?

thanks again
 
B

Brock Allen

AddHeader is a method -- it needs parenthesis around the parameters. And
then, yes, a semicolon at the end.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top