Parser Error: The server block is not well formed

Discussion in 'ASP .Net' started by Assimalyst, Jul 25, 2005.

  1. Assimalyst

    Assimalyst Guest

    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.
    Assimalyst, Jul 25, 2005
    #1
    1. Advertising

  2. Assimalyst

    Karl Seguin Guest

    I think you want to remove the @ from all of those.

    or make use of the @OutputCache directive...

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is
    annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)
    "Assimalyst" <> wrote in message
    news:...
    > 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.
    >
    Karl Seguin, Jul 25, 2005
    #2
    1. Advertising

  3. Assimalyst

    Brock Allen Guest

    Change:

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


    To:

    <% Response.Expires = 0; %>

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

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen
    Brock Allen, Jul 25, 2005
    #3
  4. Assimalyst

    Assimalyst Guest

    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
    Assimalyst, Jul 25, 2005
    #4
  5. Assimalyst

    Brock Allen Guest

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

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > 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
    >
    Brock Allen, Jul 25, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mike
    Replies:
    3
    Views:
    14,657
    Karl Seguin
    Nov 24, 2005
  2. Replies:
    12
    Views:
    5,723
    JasonG
    Jul 9, 2009
  3. =?Utf-8?B?c3Jpbml2YXM=?=

    The server tag is not well formed.

    =?Utf-8?B?c3Jpbml2YXM=?=, Mar 2, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    750
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Mar 3, 2007
  4. =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=

    The server tag is not well formed

    =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=, Aug 17, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    440
    =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=
    Aug 20, 2007
  5. Rishi  Dhupar

    Parser.pm -- not well-formed error

    Rishi Dhupar, Apr 13, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    358
    Michel Rodriguez
    Apr 13, 2005
Loading...

Share This Page