redirect to default

G

Guest

Hi,
in asp.net , I set the start page to "myStartingPage.html"
when user get authenticated and the cookie is created, the following
statement is supposed to redirect him to the original requested url:
....... ..... .... ...
Dim url As String = FormsAuthentication.GetRedirectUrl(userID, true)
Response.Redirect(url)

but url value is always = "default.aspx" and there is no "default.aspx" in
the whole application.

isn't "myStartingPage.html" supposed to be the requested url , or I'm wrong ?
and how can I set the value of the default page to point to
"myStartingPage.html" ?

<authentication mode="Forms">
<forms name="exitinterviewCookie" protection="All" timeout="60"
loginUrl="Login.aspx" />
</authentication>

thanks
 
K

Ken Dopierala Jr.

Hi,

I'm not sure why you are getting that result. When I do this I've always
done it with one line:

FormsAuthentication.RedirectFromLoginPage(userID, True)

After you authenticate the user the line above will automatically move them
along. This way you don't need to use two lines of code or do the redirect
yourself. Good luck! Ken.
 
S

Steven Cheng[MSFT]

Hi Zino,

As for the problem you mentioned, I think the main cause is the IIS Virtual
dir's default docment setting, also there are some other things we should
pay attention, let's check them step by step:

1. The reason why you found the FormsAuthentication.GetRedirectUrl always
return the "default.aspx" , I think this should occur when we visit the web
application via such url:
http://webserver/webapp/
rather than
http://webserver/webapp/certainpage.aspx yes? ( I think this url will be
redirected to login page with the
certainpage.aspx as the RedirectUrl value)

When we using the first style url, the IIS will look for the default
document in the VIRTUAL DIR, and by default there will have "default.asp",
"default.html",... ."default.aspx" in the default document list, and since
only the "default.aspx" will be processed by asp.net , so the "Original
Requested Url" will be the "default.aspx" when redirected to login page.

2. If you want to make your own page as the default visited document, you
can add them in the IIS's virutal dir default document list. Just start the
IIS management console( inetmgr.exe) and select the virtual dir's
properties and swtich into "documents" panel , you'll find that setting.

3. As you mentioned that you have your own start page "myStartPage.htmL"
,yes? If so, I strongly recommend that you change your myStartPage.html
into an ASP.NET web page. Because only "aspx" page will be served by
asp.net runtime. Static pages othe static resource will directly be
processed by IIS rather than ASP.NET. So the html pages can't be protected
by the ASP.NET's formsauthentication. WE need to make all the pages( which
should be protected by forms authentication) as aspx page.

Please have a check on the above items. If you have any other questions,
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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top