Hi everybody, how about you?

I have come across a problem. I've created a webpage and provided login user and pwd for security. There are many such pages which needs authentication for any access. For instance, there is a page called Notice Board which is linked from the index.asp page. Now if anybody wants to access that page, it immediately opens a login page where it ask for the credentials and redirects to the index.asp page on success. I want it to redirect to the Notice Board page and not the index page. What should I do to accomplish it? I've used Request.ServerVariable(HTTP_Referer) with almost no result.


PLEASE help me.


RUAM DATTA
BANGALORE

Hi,

As I understand from your statement, you have an index.asp page, which has many links, one of those is for notice board.

like
Noticeboard
Forum
About us

when you click on a link you are redirected to a login page and after validation, you want to be redirected to Noticeboard page, right?

In this case you can pass a value in querystring, like 1 for Noticeboard, 2 for forum, 3 for About us and when you validate user then depending on the value redirect user to different pages.

Hope this will help you.

Vivek :)

Hi.

create one cookie to store current page URL where user is not authenticated and redirect to login page, on success of login redirect to that stored cookie URL.

Hope this will be help you.

Actually I've some 5/6 menus in the left pane of the page and the first three menus need login for access. So when a user/person clicks on the menu it redirects to that particular page only after it check whether the user is logged in or not, If the user is not logged in it displays the login page where the user has to fill up the username and password. And if it is the correct username and password it redirects to the homepage instead of the page the first menu is linked to. So I want to keep a track of how the login page appears I mean on clicking which menu. In this context I tried to declare a session variable and assign the filename of the pages linking to in the click even of the menuitems. But it is not working , Can anyone please help me?

Regards
Rupam Datta

Hi.

create one cookie to store current page URL where user is not authenticated and redirect to login page, on success of login redirect to that stored cookie URL.

Hope this will be help you.

Hi,

Use the following logic in menu

<a href="login.asp?fp=nb">Notice Board</a>
    <a href="login.asp?fp=cr">Chat Room</a>
    <a href="aboutUs.asp">About Us</a>

The logic in login page should be

call redir()

   if request.servervariables("HTTP_METHOD") = "POST" then
         write code for checking the user credentials in database.
         if validated the user credentials then
                    session("user_loggedin") = "Y"
                    call redir()
         end if
   end if   
   function redir()
      if session("user_loggedin") = "Y" then
           if request("fp") = "nb" then
                  response.redirect ("noticeboard.asp")
           elseif request("fp") = "cr" then
                  response.redirect("chat.asp")
           else 
                  response.redirect("home.asp")
           end if
   end if

   end function
   
   Write HTML code for login page here

I hope this should solve your issue.

Thanks for the solution

Close the Thread as solved, if you have found the solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.