www.webdeveloper.com
Results 1 to 3 of 3

Thread: Javascript --> ASP

  1. #1
    Join Date
    Oct 2005
    Posts
    15

    Javascript --> ASP

    Hello All,
    I'm trying to write a page where I have to check the permission of the user to use some links.
    I've got to use a javascript function (already used by others) :

    <SCRIPT LANGUAGE="JavaScript">

    function getCookieValore(name) {

    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0)
    return null;
    } else
    begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    end = dc.length;
    var ValoreDelCookie = unescape(dc.substring(begin + prefix.length, end));
    return ValoreDelCookie;

    }

    </script>

    What I need to do is check the value returned by this function in ASP in a function similar to this one:

    function CtrlUser()

    dim user,tmpstr
    user = <!--here I have to launch getCookieValore-->
    if user = 12 then
    tmpstr = "OK!" <!--Write here the link-->
    else
    tmpstr = "KO!" <!--Write here a redirection link to homepage-->
    end if
    CtrlUser = tmpstr

    end function

    How can I recall a javascript function from ASP code?

    Thank you

  2. #2
    Join Date
    Jan 2003
    Location
    USA
    Posts
    688
    Hopefully these cookie resources will help give you some ideas:

    ASP Cookies
    http://www.w3schools.com/asp/asp_cookies.asp

    Cookie Monster: Using Cookies in ASP by Ian Stallings - 5/10/1999
    http://www.4guysfromrolla.com/webtech/051099-1.shtml

    An Overview of Cookie Detection in ASP (with Code!) by John Peterson
    http://www.asp101.com/articles/john/...ct/default.asp

  3. #3
    Join Date
    Oct 2005
    Posts
    15
    Thank you very much for your propmt reply!
    I'm checkin the sources.

    Fulvio Beretta

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles