Cookieless session problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scott

    #1

    Cookieless session problems

    Hello,

    we are having problems displaying non-aspx files (images, style
    sheets) since we have upgraded to the 1.1 framework when using a
    cookieless session (sessionID in the url).

    Check out our file system set up below. Now, in an aspx page, we set
    as the "src" of our images something like "../images/animage.jpg". If
    the current actual url in the browser is something like

    then the url of the image could be interpreted as something like

    (I think). (In the rendered html, of course, the image tag looks
    like: <img src="../images/animage.jpg">.)

    In the old framework, this way of specifying the image src url (ie.
    relative url) with cookieless sessions worked. However, in the new
    framework (1.1), it does not work. In testing, though, if we manually
    type the following url in the browser, the image is correctly
    retrieved:


    It seems that ASP/IIS takes the session ID in the url as a real part
    of the path.

    The above solution (adding another set of "../" if the
    Session.IsCooki eless=false) to all url's for images, stylesheets,
    javascript files, etc is a possible workaround, but we think it's
    ugly. (Alternatives would be greatly appreciated.)

    So we are stumped. Frankly, we are surprised that more people have
    not brought this issue to the newsgroups' attention.


    --our set-up---
    Virtual Directory : http://server/webapp
    located at: c:\inetpub\wwwr oot\webapp
    and images at: c:\inetpub\wwwr oot\webapp\imag es
    aspx forms at: c:\inetpub\wwwr oot\webapp\form s


    Scott
    Jerome


  • Scott

    #2
    Re: Cookieless session problems

    Hi Cowboy,

    We use your method #2 to link to images (stylesheets, javascript
    files, etc). Let me see if I can explain this in a better way.

    If we store the session in a cookie, things would look like this:
    current page url : http://server/virtual/forms/form1.aspx
    which could have an image tag with src="../images/image.gif"
    which would mean that the _absolute_ url of the image that the browser
    will use to get it is something like:


    If we store the session id in the url (cookieless), then things turn
    into this:
    current page url :

    with an image tag src="../images/image.gif"
    which leads to an "absolute" url for the browser of:



    This is the problem (I think): When we use a relative url for
    non-aspx pages, IIS does not give "control" to the aspnet process, so
    the session id is not stripped out of the url, which means that IIS
    thinks (if it does) that the session id is just another directory of
    the url. I do use the "engine" in some other applications, notably
    where the images are coming from a db and such, but it would be nice
    if i did not have to do the same things for style sheets (etc).

    I also think it is strange that we only noticed this problem after
    installing the 1.1 Framework.

    Thanks,
    Scott

    "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld @comcast.netRem uvThis>
    wrote in message news:uNm9X%23qU DHA.1276@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    > Images do not require session. As such, you would generally ignore[/color]
    the[color=blue]
    > session with images. In most apps, you drive images in one of three[/color]
    ways:[color=blue]
    >
    > 1. Direct access http://mysite.com/image.gif
    > 2. Through relative URLs in the page
    > 3. Through an image engine http://mysite.com/image.aspx?id=283490856
    >
    > When using cookieless sessions, direct access becomes a bit more of[/color]
    a pain,[color=blue]
    > but .NET can handle it for you ... without the traverse, that is. If[/color]
    the[color=blue]
    > traverse is necessary, you may need to create an image serving page[/color]
    (engine)[color=blue]
    > and let it pull the image from the file sys.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    > Author: ADO.NET and XML: ASP.NET on the Edge
    >
    >[/color]
    *************** *************** *************** *************** **********
    ******[color=blue]
    > ****
    > Think Outside the Box!
    >[/color]
    *************** *************** *************** *************** **********
    ******[color=blue]
    > ****
    > "Scott" <scoonce@thegap JUNKcompany.com > wrote in message
    > news:%23NqjBToU DHA.2184@TK2MSF TNGP10.phx.gbl. ..[color=green]
    > > Hello,
    > >
    > > we are having problems displaying non-aspx files (images, style
    > > sheets) since we have upgraded to the 1.1 framework when using a
    > > cookieless session (sessionID in the url).
    > >
    > > Check out our file system set up below. Now, in an aspx page, we[/color][/color]
    set[color=blue][color=green]
    > > as the "src" of our images something like "../images/animage.jpg".[/color][/color]
    If[color=blue][color=green]
    > > the current actual url in the browser is something like
    > > http://server/webapp/(someSessionID)/forms/form1.aspx
    > > then the url of the image could be interpreted as something like
    > >[/color]
    >[/color]
    http://server/webapp/(someSessionID)...es/animage.jpg[color=blue][color=green]
    > > (I think). (In the rendered html, of course, the image tag looks
    > > like: <img src="../images/animage.jpg">.)
    > >
    > > In the old framework, this way of specifying the image src url[/color][/color]
    (ie.[color=blue][color=green]
    > > relative url) with cookieless sessions worked. However, in the[/color][/color]
    new[color=blue][color=green]
    > > framework (1.1), it does not work. In testing, though, if we[/color][/color]
    manually[color=blue][color=green]
    > > type the following url in the browser, the image is correctly
    > > retrieved:
    > >[/color]
    >[/color]
    http://server/webapp/(someSessionID)...es/animage.jpg[color=blue][color=green]
    > >
    > > It seems that ASP/IIS takes the session ID in the url as a real[/color][/color]
    part[color=blue][color=green]
    > > of the path.
    > >
    > > The above solution (adding another set of "../" if the
    > > Session.IsCooki eless=false) to all url's for images, stylesheets,
    > > javascript files, etc is a possible workaround, but we think it's
    > > ugly. (Alternatives would be greatly appreciated.)
    > >
    > > So we are stumped. Frankly, we are surprised that more people[/color][/color]
    have[color=blue][color=green]
    > > not brought this issue to the newsgroups' attention.
    > >
    > >
    > > --our set-up---
    > > Virtual Directory : http://server/webapp
    > > located at: c:\inetpub\wwwr oot\webapp
    > > and images at: c:\inetpub\wwwr oot\webapp\imag es
    > > aspx forms at: c:\inetpub\wwwr oot\webapp\form s
    > >
    > >
    > > Scott
    > > Jerome
    > >
    > >[/color]
    >
    >[/color]


    Comment

    • levous

      #3
      Re: Cookieless session problems

      problems displaying images, style sheets using cookieless session
      (sessionID in the url) - cookieless session broken images.

      Finally... I found the answer! at least in my case.
      Hope this helps!
      Check your isapi filters in iis. Make sure ASP.net is included and
      running. Here's how.

      open internet services manager
      right clik on the server node and choose properties
      master properties <edit>
      (tab) isapi flters
      look for an entry "ASP.NET_x.xx.x .x.x"
      if it is not there, this is your problem!

      <add> ASP.Net
      C:\WINNT\Micros oft.NET\Framewo rk\v1.0.3705\as pnet_filter.dll

      the above value is for 1.0.3705
      you should use whichever version you are running.
      restart iis

      "Scott" <scoonce@thegap JUNKcompany.com > wrote in message news:<#NqjBToUD HA.2184@TK2MSFT NGP10.phx.gbl>. ..[color=blue]
      > Hello,
      >
      > we are having problems displaying non-aspx files (images, style
      > sheets) since we have upgraded to the 1.1 framework when using a
      > cookieless session (sessionID in the url).
      >
      > Check out our file system set up below. Now, in an aspx page, we set
      > as the "src" of our images something like "../images/animage.jpg". If
      > the current actual url in the browser is something like
      > http://server/webapp/(someSessionID)/forms/form1.aspx
      > then the url of the image could be interpreted as something like
      > http://server/webapp/(someSessionID)...es/animage.jpg
      > (I think). (In the rendered html, of course, the image tag looks
      > like: <img src="../images/animage.jpg">.)
      >
      > In the old framework, this way of specifying the image src url (ie.
      > relative url) with cookieless sessions worked. However, in the new
      > framework (1.1), it does not work. In testing, though, if we manually
      > type the following url in the browser, the image is correctly
      > retrieved:
      > http://server/webapp/(someSessionID)...es/animage.jpg
      >
      > It seems that ASP/IIS takes the session ID in the url as a real part
      > of the path.
      >
      > The above solution (adding another set of "../" if the
      > Session.IsCooki eless=false) to all url's for images, stylesheets,
      > javascript files, etc is a possible workaround, but we think it's
      > ugly. (Alternatives would be greatly appreciated.)
      >
      > So we are stumped. Frankly, we are surprised that more people have
      > not brought this issue to the newsgroups' attention.
      >
      >
      > --our set-up---
      > Virtual Directory : http://server/webapp
      > located at: c:\inetpub\wwwr oot\webapp
      > and images at: c:\inetpub\wwwr oot\webapp\imag es
      > aspx forms at: c:\inetpub\wwwr oot\webapp\form s
      >
      >
      > Scott
      > Jerome[/color]

      Comment

      • Scott

        #4
        Re: Cookieless session problems

        We haven't been able to try it yet to see if this was our problem (IIS
        filter was empty though).

        Thank you, levous, for your solution. Been looking for something like
        this for a long time; thanks.

        Scott

        "levous" <rzarse@yahoo.c om> wrote in message
        news:81ae55e.03 08040631.2e8012 ae@posting.goog le.com...[color=blue]
        > problems displaying images, style sheets using cookieless session
        > (sessionID in the url) - cookieless session broken images.
        >
        > Finally... I found the answer! at least in my case.
        > Hope this helps!
        > Check your isapi filters in iis. Make sure ASP.net is included and
        > running. Here's how.
        >
        > open internet services manager
        > right clik on the server node and choose properties
        > master properties <edit>
        > (tab) isapi flters
        > look for an entry "ASP.NET_x.xx.x .x.x"
        > if it is not there, this is your problem!
        >
        > <add> ASP.Net
        > C:\WINNT\Micros oft.NET\Framewo rk\v1.0.3705\as pnet_filter.dll
        >
        > the above value is for 1.0.3705
        > you should use whichever version you are running.
        > restart iis
        >
        >
        >
        > "Scott" <scoonce@thegap JUNKcompany.com > wrote in message[/color]
        news:<eCbeBlZVD HA.2268@TK2MSFT NGP11.phx.gbl>. ..[color=blue][color=green]
        > > Hi Cowboy,
        > >
        > > We use your method #2 to link to images (stylesheets, javascript
        > > files, etc). Let me see if I can explain this in a better way.
        > >
        > > If we store the session in a cookie, things would look like this:
        > > current page url : http://server/virtual/forms/form1.aspx
        > > which could have an image tag with src="../images/image.gif"
        > > which would mean that the _absolute_ url of the image that the[/color][/color]
        browser[color=blue][color=green]
        > > will use to get it is something like:
        > > http://server/virtual/forms/../images/image.gif
        > >
        > > If we store the session id in the url (cookieless), then things[/color][/color]
        turn[color=blue][color=green]
        > > into this:
        > > current page url :
        > > http://server/virtual/(1c3ejx25cbrwk...rms/form1.aspx
        > > with an image tag src="../images/image.gif"
        > > which leads to an "absolute" url for the browser of:
        > >[/color][/color]
        http://server/virtual/(1c3ejx25cbrwk...ages/image.gif[color=blue][color=green]
        > >
        > >
        > > This is the problem (I think): When we use a relative url for
        > > non-aspx pages, IIS does not give "control" to the aspnet process,[/color][/color]
        so[color=blue][color=green]
        > > the session id is not stripped out of the url, which means that[/color][/color]
        IIS[color=blue][color=green]
        > > thinks (if it does) that the session id is just another directory[/color][/color]
        of[color=blue][color=green]
        > > the url. I do use the "engine" in some other applications,[/color][/color]
        notably[color=blue][color=green]
        > > where the images are coming from a db and such, but it would be[/color][/color]
        nice[color=blue][color=green]
        > > if i did not have to do the same things for style sheets (etc).
        > >
        > > I also think it is strange that we only noticed this problem after
        > > installing the 1.1 Framework.
        > >
        > > Thanks,
        > > Scott
        > >
        > > "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld @comcast.netRem uvThis>
        > > wrote in message news:uNm9X%23qU DHA.1276@TK2MSF TNGP09.phx.gbl. ..[color=darkred]
        > > > Images do not require session. As such, you would generally[/color][/color][/color]
        ignore[color=blue][color=green]
        > > the[color=darkred]
        > > > session with images. In most apps, you drive images in one of[/color][/color][/color]
        three[color=blue][color=green]
        > > ways:[color=darkred]
        > > >
        > > > 1. Direct access http://mysite.com/image.gif
        > > > 2. Through relative URLs in the page
        > > > 3. Through an image engine[/color][/color][/color]
        http://mysite.com/image.aspx?id=283490856[color=blue][color=green][color=darkred]
        > > >
        > > > When using cookieless sessions, direct access becomes a bit more[/color][/color][/color]
        of[color=blue][color=green]
        > > a pain,[color=darkred]
        > > > but .NET can handle it for you ... without the traverse, that[/color][/color][/color]
        is. If[color=blue][color=green]
        > > the[color=darkred]
        > > > traverse is necessary, you may need to create an image serving[/color][/color][/color]
        page[color=blue][color=green]
        > > (engine)[color=darkred]
        > > > and let it pull the image from the file sys.
        > > >
        > > > --
        > > > Gregory A. Beamer
        > > > MVP; MCP: +I, SE, SD, DBA
        > > > Author: ADO.NET and XML: ASP.NET on the Edge
        > > >
        > > >[/color]
        > >[/color][/color]
        *************** *************** *************** *************** **********[color=blue][color=green]
        > > ******[color=darkred]
        > > > ****
        > > > Think Outside the Box!
        > > >[/color]
        > >[/color][/color]
        *************** *************** *************** *************** **********[color=blue][color=green]
        > > ******[color=darkred]
        > > > ****
        > > > "Scott" <scoonce@thegap JUNKcompany.com > wrote in message
        > > > news:%23NqjBToU DHA.2184@TK2MSF TNGP10.phx.gbl. ..
        > > > > Hello,
        > > > >
        > > > > we are having problems displaying non-aspx files (images,[/color][/color][/color]
        style[color=blue][color=green][color=darkred]
        > > > > sheets) since we have upgraded to the 1.1 framework when using[/color][/color][/color]
        a[color=blue][color=green][color=darkred]
        > > > > cookieless session (sessionID in the url).
        > > > >
        > > > > Check out our file system set up below. Now, in an aspx page,[/color][/color][/color]
        we[color=blue][color=green]
        > > set[color=darkred]
        > > > > as the "src" of our images something like[/color][/color][/color]
        "../images/animage.jpg".[color=blue][color=green]
        > > If[color=darkred]
        > > > > the current actual url in the browser is something like
        > > > > http://server/webapp/(someSessionID)/forms/form1.aspx
        > > > > then the url of the image could be interpreted as something[/color][/color][/color]
        like[color=blue][color=green][color=darkred]
        > > > >
        > > >[/color]
        > >[/color][/color]
        http://server/webapp/(someSessionID)...es/animage.jpg[color=blue][color=green][color=darkred]
        > > > > (I think). (In the rendered html, of course, the image tag[/color][/color][/color]
        looks[color=blue][color=green][color=darkred]
        > > > > like: <img src="../images/animage.jpg">.)
        > > > >
        > > > > In the old framework, this way of specifying the image src url[/color]
        > > (ie.[color=darkred]
        > > > > relative url) with cookieless sessions worked. However, in[/color][/color][/color]
        the[color=blue][color=green]
        > > new[color=darkred]
        > > > > framework (1.1), it does not work. In testing, though, if we[/color]
        > > manually[color=darkred]
        > > > > type the following url in the browser, the image is correctly
        > > > > retrieved:
        > > > >
        > > >[/color]
        > >[/color][/color]
        http://server/webapp/(someSessionID)...es/animage.jpg[color=blue][color=green][color=darkred]
        > > > >
        > > > > It seems that ASP/IIS takes the session ID in the url as a[/color][/color][/color]
        real[color=blue][color=green]
        > > part[color=darkred]
        > > > > of the path.
        > > > >
        > > > > The above solution (adding another set of "../" if the
        > > > > Session.IsCooki eless=false) to all url's for images,[/color][/color][/color]
        stylesheets,[color=blue][color=green][color=darkred]
        > > > > javascript files, etc is a possible workaround, but we think[/color][/color][/color]
        it's[color=blue][color=green][color=darkred]
        > > > > ugly. (Alternatives would be greatly appreciated.)
        > > > >
        > > > > So we are stumped. Frankly, we are surprised that more people[/color]
        > > have[color=darkred]
        > > > > not brought this issue to the newsgroups' attention.
        > > > >
        > > > >
        > > > > --our set-up---
        > > > > Virtual Directory : http://server/webapp
        > > > > located at: c:\inetpub\wwwr oot\webapp
        > > > > and images at: c:\inetpub\wwwr oot\webapp\imag es
        > > > > aspx forms at: c:\inetpub\wwwr oot\webapp\form s
        > > > >
        > > > >
        > > > > Scott
        > > > > Jerome
        > > > >
        > > > >
        > > >
        > > >[/color][/color][/color]


        Comment

        Working...