467,174 Members | 1,321 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,174 developers. It's quick & easy.

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 = "na**@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.Current.User Is Nothing)) The
If (HttpContext.Current.User.Identity.IsAuthenticated ) The
If (HttpContext.Current.User.Identity.AuthenticationT ype = "Forms") The

Dim id As System.Web.Security.FormsIdentity = HttpContext.Current.User.Identit
Dim myTicket As System.Web.Security.FormsAuthenticationTicket = id.Ticke

Dim userData As String = myTicket.UserDat
Dim myRoles As String() = Split(userData, ","
HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(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
Nov 18 '05 #1
  • viewed: 2003
Share:
6 Replies
Hi,

From your description, you're using FormsAuthentication 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 FormsAuthentication, 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
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2
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.ServerVariables("URL") OR Request.Url.AbsoluteUri OR request.Url OR ....
but I always get the url for the default page
Nov 18 '05 #3
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
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #4
Hi
here is more detail about the pages

Default.aspx page
<frameset rows="105px,*"><frame name="top_" src="topPage.aspx" ><frameset cols="155,*" ><frame name="left_" src="leftPage.aspx" ><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(top 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.aspx?id=123' target='right'>
.... ...... ......

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

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

What happens is; when the user click the link, the browser load the app and the welcome page load instead of pageProduct.aspx in the right frame, after the browser load the app completly, if the user click again on the link, pageProduct.aspx 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.AbsoluteUri
o
Request.ServerVariables("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


Nov 18 '05 #5
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.aspx?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.href="Default.aspx";}
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.aspx page in it. Then because of the if (top.location ==
self.location) {top.location.href="Default.aspx";} 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.aspx 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
http://servername/appname/default.as...geProduct.aspx

in the default page, we change the template as below
<frameset rows="105px,*"><frame name="top_" src="topPage.aspx" ><frameset
cols="155,*" ><frame name="left_" src="leftPage.aspx" ><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.html";
string url = Request.QueryString["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.aspx as below:

if (top.location == self.location)
{
top.location.href="Default.aspx?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

http://msdn.microsoft.com/library/de...us/vsdebug/htm
l/vxgrfaspnetdebuggingsystemrequirements.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
http://msdn.microsoft.com/asp.net/whidbey/default.aspx



Nov 18 '05 #6
Hi Steven
thank you very much for your support, you were a great help for me

thank you again.
Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Viktor Popov | last post: by
14 posts views Thread by Stingray | last post: by
1 post views Thread by Viktor Popov | last post: by
7 posts views Thread by Kurda Yon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.