Form Authentication

S

slawek xxxxx

Hello everyone,

I have found a problem with form authentication method that I can't
solve. The problem is:

I want to use a form authentication in my application, so i set :
<authentication mode="Forms">
,and
<forms name="LoginForm" loginUrl="SM_LoginPage.aspx" protection="All">

but the structure of my application folders is following:

root
|
+CommonPages
| + loginPage.aspx
|
+SysPages
| + Sys1Pages
| | +Page1.aspx
| + Sys2Pages
| +Page2.aspx
+ OtherPages
+ Page3.asp

Because of this structure the relative path of LoginPage.aspx is
diffrent for Page1.aspx(../../CommonPages/loginPage.aspx) and Page for
page3.aspx(../CommonPages/loginPage.aspx). I have to set this path in
web.config and I want to use relative path (not http://.....). Is there
any way to do this?? (sth like {root}//CommonPages/loginPage.aspx)??
Thanks for any help

Best Regards
Slawek
 
M

Michael Mayer [C# MVP]

Try "~/CommonPages/loginPage.aspx"

Commands like Response.Redirect() and a lot of other server side controls
interpret "~/" as application root. Be careful that you dont do something
like this:

<A href="~/CommonPages/loginPage.aspx">Login</a>
because the users machine won't know ~/

Instead, i think this would work:
<A href='<%# ~/CommonPages/loginPage.aspx %>'>Login</a>
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top