Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Edward Dudley 80 posts 121 karma points
    Oct 20, 2009 @ 17:40
    Edward Dudley
    0

    Request Scope Variables

    Hi,

    Is there any way to store variables in the request scope?

    I know in Java you can add attributes (variables) to a request.  These attributes only exist for the request and are destroyed once the request is returned.

    I know I could use session variables to store stuff but due to my server configuration this isn't ideal.

    (sorry this is a .net question - I posted here as I'm using this in Umbraco and if its possible I'll make an XSLT extension)

    I'm quite new to .net so sorry if this is a stupid question!

    Thanks,

    Ed

  • Chris Koiak 700 posts 2626 karma points
    Oct 20, 2009 @ 18:22
    Chris Koiak
    0

    Hi Edward,

    You can store variables for the duration of the request in HttpContext. It's a key value pair dictionary.

    This can be accessed from xslt via umbraco.library:ContextKey(string), however I'm not too sure if there's a built in way to write to it via xslt extension.

    You could definately write your own extension to save values to the HttpContext.

    Cheers,

    Chris

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 20, 2009 @ 18:22
    Nik Wahlberg
    0

    Hi Ed,

    are you talking about CGI vars in Java? If so, check out this article http://forums.asp.net/t/1237153.aspx.

    If not, can you give us a synopsis of what you are trying to do? We might be able to think of other ways other than session scope.

    Thanks,
    Nik

  • Edward Dudley 80 posts 121 karma points
    Oct 21, 2009 @ 06:26
    Edward Dudley
    0

    Thanks for the replies!

    I've done some googleing and the HttpContext is what I'm looking for.

    @Nik - in Java I use request.setAttribute(key, object).  I think the items in HttpContext are the .Net equivalent.  Thanks for your help though!

    My plan is to write an extension that allows XML (maybe NodesetIterator) to be stored onto the request so that data can be passed between various pages called using RenderTemplate.

    If I get an extension written I'll post again with a package / link to a package.

Please Sign in or register to post replies

Write your reply to:

Draft