link parameters

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

    link parameters

    my web application consist of 3 frames :top, left and right, and I use form authentication to authenticate users in ASP.NET 1.
    the right frame is where the data is displayed
    I set the default page (as it's required by VS) to some of my pages (default.aspx)
    there is somewhere in the application where an e-mail is sent to some users containing a url with parameters needed by the page (pageX.aspx) to query the database and return the result to the user
    the way the e-mail is sent

    Dim email As New System.Web.Mail .MailMessag
    With emai
    .To = "name@email .com
    ... .... ......
    .Body = "click on this link to open the page : <a href='http://mySite/pageX.aspx?id=" & param & "</a>
    ... ..... .......

    when the user click the link, he get always directed to the default page, even if he was authenticated previously and the authentication cookie is saved on his machin

    the authenticataion in Global.asax
    If (Not (HttpContext.Cu rrent.User Is Nothing)) The
    If (HttpContext.Cu rrent.User.Iden tity.IsAuthenti cated) The
    If (HttpContext.Cu rrent.User.Iden tity.Authentica tionType = "Forms") The

    Dim id As System.Web.Secu rity.FormsIdent ity = HttpContext.Cur rent.User.Ident it
    Dim myTicket As System.Web.Secu rity.FormsAuthe nticationTicket = id.Ticke

    Dim userData As String = myTicket.UserDa t
    Dim myRoles As String() = Split(userData, ","
    HttpContext.Cur rent.User = New System.Security .Principal.Gene ricPrincipal(id , myRoles
    End I
    End I

    what am I supposed to do to let the user go directly to the page specified by the url where the designated page can query the parameter from the url ?

    thanks for hel


  • Steven Cheng[MSFT]

    #2
    RE: link parameters

    Hi,

    From your description, you're using FormsAuthentica tion in your asp.net web
    application and the web pages are layouted as frame based. top , left and
    right. Currently, you will send a mail which contains a hyperlink point to
    the
    web application's certain page. However, you found everytime the user click
    the link, he'll be reidirect to the default page in the web application
    rather than the hyperlink's href url, yes?

    As for the problem, I'm still wondering some points:
    1. Since you put the url in a hyperlink in the email's body. Does the
    problem remains if we put the link in a normal html page or type the url in
    the browser's address bar directly to visit the page?

    2. What's the page's position in the web application? Is it in the main
    frame or a certain sub frame ? What does the default page? the default
    document set in the IIS virutal directory? Based on my understanding , if
    the problem occur in the FormsAuthentica tion, the user should be redirect
    to the "Login" page rather than default page. What's your login page set in
    the web.config's <forms > element?

    3. Are you sure that when the problem occur, the user still has the
    authentication cookie existing at clientside? If you manually type the url
    of a protected page( deny="?") , can you visit it or be redirected to login
    page?

    In addition, there are many form threads on the similiar prolbems in this
    newsgroup, you can search them in the google's "group" section. Maybe they
    will also provide some clues.

    If you have any questions or new findings, please feel free to post here.
    Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.




    Comment

    • zino

      #3
      RE: link parameters

      I try to read the url in Default.aspx (frameset page) in order to see if the request has the parameter supplied by the link from the e-mail, by using
      Request.ServerV ariables("URL") OR Request.Url.Abs oluteUri OR request.Url OR ....
      but I always get the url for the default page


      Comment

      • Steven Cheng[MSFT]

        #4
        RE: link parameters

        Hi,

        Thanks for the response. I'm still so confused about the url you put in the
        hyperlink in the email and your page's strucutre. Would you please provide
        me the full url you used to link to the certain page you want. And also, I
        think you can provide the main frame page's url and how it control its sub
        frame(top, left, right) 's src, For example

        Http://servername/appname/mainframe.aspx?leftsrc= ... & rightsrc=...

        Thus, it'll be helpful us to do some further research, Thanks.

        Regards,

        Steven Cheng
        Microsoft Online Support

        Get Secure! www.microsoft.com/security
        (This posting is provided "AS IS", with no warranties, and confers no
        rights.)

        Get Preview at ASP.NET whidbey
        Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.


        Comment

        • zino

          #5
          RE: link parameters

          Hi
          here is more detail about the pages

          Default.aspx page
          <frameset rows="105px,*"> <frame name="top_" src="topPage.as px" ><frameset cols="155,*" ><frame name="left_" src="leftPage.a spx" ><frame name="right_" src="rightPage. htm" ></frameset></frameset

          rightPage.html is just a welcome page, that will be replaced by other page, once user click any link from topPage.aspx(to p frame
          there is nothing in the code behind of this Default.aspx page

          from some page in the app, I send an e-mail to a user containing this link as
          .... ..... .......
          email.Body
          "open page product from this link: <a href='http://servername/appName/pageProduct.asp x?id=123' target='right'>
          .... ...... ......

          pageProduct.asp x is supposed to be loaded in the right frame of Default.aspx.
          pageProduct.asp x is forced to be loaded into a frame through this client script
          if (top.location == self.location) {top.location.h ref="Default.as px";

          and then it extract the parameter passed through the url : .... Request.QuerySt ring("id") ....

          What happens is; when the user click the link, the browser load the app and the welcome page load instead of pageProduct.asp x in the right frame, after the browser load the app completly, if the user click again on the link, pageProduct.asp x load in the right frame this time
          I want that when the link is clicked , IE open a new window ,the app load, and pageProduct load automatically instead of the welcome page, without a need to click the link agai

          I tried to read the url from Default.aspx page like
          Request.Url.Abs oluteUri
          o
          Request.ServerV ariables("URL")
          so I can load the appropriate page depending on the url, but I always get the following url
          http://servername/appName/Default.aspx.

          thank ou again for any hel




          Comment

          • Steven Cheng[MSFT]

            #6
            RE: link parameters

            Hi,

            Thanks very much for your response and the detailed description, I think
            I've got the your problem from the your last reply.

            In your email, you used the following hyperlink
            <a href='http://servername/appName/pageProduct.asp x?id=123' target='right'>

            to open the pageProcduct page in the "right" frame, also in the pageProduct
            you use the
            if (top.location == self.location) {top.location.h ref="Default.as px";}
            javascript to make sure the top frame is the default page, yes?

            The problems is that when the user first time click the link, there is no
            existing opened IE window, of course , there is no "right" frame, so it
            can't find the "right" frame and then open a new browser window and locate
            the pageProduct.asp x page in it. Then because of the if (top.location ==
            self.location) {top.location.h ref="Default.as px";} code, the browser will
            replace the page in it with the default.aspx , that's why you see the
            default page and the right frame is the "wecome page" by default.
            And when you click the hyperlink again, since there is an existing opened
            browser with default page in it and it can find a "right" frame in it, this
            time the pageProduct.asp x page will be successfully located in the right
            frame of the existing default page. Do you understand this?

            As for how to resolve this, I think we have to put some code logic to set
            the sub frame's location in the default.aspx page. We can provide a
            querystring parameter for the default.aspx page to spcecify which url will
            be loaded in the right frame , then in the default page we specify the src
            of the left frame according to the querystring's value

            for example, we request the default page as following


            in the default page, we change the template as below
            <frameset rows="105px,*"> <frame name="top_" src="topPage.as px" ><frameset
            cols="155,*" ><frame name="left_" src="leftPage.a spx" ><frame name="right_"
            src="<%= contentUrl %>" ></frameset></frameset>

            contentUrl is a page member and we can set it in the Page_Load

            Page_Load......
            {
            this.contentUrl = "welcome.ht ml";
            string url = Request.QuerySt ring["url"];
            if(url != null)
            {
            this.contentUrl = url;
            }

            }

            Thus, we can dynamically change the right frame's page via providing a
            querystring and we can change the script
            in pageProduct.asp x as below:

            if (top.location == self.location)
            {
            top.location.hr ef="Default.asp x?url=" + self.location;
            }

            How do you think of this? In fact, you can have a look at MSDN library's
            page's url , such as


            l/vxgrfaspnetdebu ggingsystemrequ irements.asp

            You can find the msdn library's article page will be always located in a
            sub frame in the default.asp and there is a
            "url" querystring used to speicfy the main frame's location.

            Above is some of my suggestions. Hope helps. Thanks.

            Regards,

            Steven Cheng
            Microsoft Online Support

            Get Secure! www.microsoft.com/security
            (This posting is provided "AS IS", with no warranties, and confers no
            rights.)

            Get Preview at ASP.NET whidbey
            Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.












            Comment

            • zino

              #7
              RE: link parameters

              Hi Steven
              thank you very much for your support, you were a great help for me

              thank you again.

              Comment

              Working...