CSS Formatting not appearing on Login page

B

Bazza Formez

Hi,

I have an app which utilizes forms security. I have a Login.aspx page
which references my MasterPage.master. The master page in turn
references a css.

In the designer of VS 2005, the Login page renders correctly.... with
correct formatting as provided by my css.

At application runtime however, all formatting disappears on the login
page... no css formatting occurs at all.

Note that other pages in the app (ie. subsequent to login) appear
correctly formatted. This is puzzling!

Another hint : this was all working until I created a sub-directory
under the root of the app & moved web pages to there.

My ide is VS 2005 (completely up to date version).

Any ideas ?

Thanks,
Bazza
 
A

Alexey Smirnov

Hi,

I have an app which utilizes forms security. I have a Login.aspx page
which references my MasterPage.master. The master page in turn
references a css.

In the designer of VS 2005, the Login page renders correctly.... with
correct formatting as provided by my css.

At application runtime however, all formatting disappears on the login
page... no css formatting occurs at all.

Note that other pages in the app (ie. subsequent to login) appear
correctly formatted. This is puzzling!

Another hint : this was all working until I created a sub-directory
under the root of the app & moved web pages to there.

My ide is VS 2005 (completely up to date version).

Any ideas ?

Thanks,
Bazza

Do you use an absolute path with slash at beginning to CSS?

e.g.

<link type="text/css" href="/style.css" rel="stylesheet">
 
B

Bazza Formez

Hi Alexey,

Thanks for your reply.

The code I had was :
<link href="styles.css" rel="stylesheet" type="text/css" />

(By the way ... The css is in the same directory as the masterpage.)

I have tried the following using an absolute path ....
<link href="~/mydirectory/styles.css" rel="stylesheet" type="text/
css" />

But this also gave same problem..

Any other ideas Alexey ?

Many thanks,
Bazza
 
B

Bazza Formez

Hi Alexey,

Thanks for your reply.

The code I had was :
<link href="styles.css" rel="stylesheet" type="text/css" />

(By the way ... The css is in the same directory as the masterpage.)

I have tried the following using an absolute path ....
<link href="~/mydirectory/styles.css" rel="stylesheet" type="text/
css" />

But this also gave same problem..

Any other ideas Alexey ?

Many thanks,
Bazza
 
A

Alexey Smirnov

I have tried the following using an absolute path ....
<link href="~/mydirectory/styles.css" rel="stylesheet" type="text/
css" />

This is wrong. The tilda-prefix "~" can be used for server-side
controls only.

So, please try

<link href="/mydirectory/styles.css" ....

If this still doesn't work, check if it's not the cache problem.
Refresh the login page with Ctrl+F5, or delete all cached files.
 
B

Bazza Formez

Thanks.

(In masterpage) I changed it to :

<link href="/mydirectory/styles.css" rel="stylesheet" type="text/css" /

still same prob.

Note that all other pages in site using same masterpage work fine....


Can you tell me where cached files live please ?

thanks,
Bazza
 
A

Alexey Smirnov

Thanks.

(In masterpage) I changed it to :

<link href="/mydirectory/styles.css" rel="stylesheet" type="text/css" /


still same prob.

So, let's check:

1. login.aspx used a master
2. login.aspx, masterpage, styles.css are in the same directory
(mydirectory)
3. site has the following structure:

root
------mydirectory
---------------login.aspx
---------------masterpage
---------------styles.css
---------------others

Note that all other pages in site using same masterpage work fine....

Can you tell me where cached files live please ?

You can remove the IE cache from menu (Tools - Internet Options,
Browsing History...). IE has a problem with caching the CSS and maybe
you cannot see the style because of this problem. Maybe you can try to
restart the web server.
 
B

Bazza Formez

I deleted cache.. no luck there.

1. yes, login.aspx uses the master page
2. login.aspx, master page * styles.css all in same directory
3. My directory structure is just as you have described....

Full structure (in case it helps) is :

root
-----web.config
-----web.sitemap
-----App_Code (asp.net folder)
---------------BLL directory
---------------DAL directory
-----App_Data (asp.net folder)
---------------mydb.mdb
-----MyDirectory directory
---------------styles.css
---------------masterpage.master
---------------login.aspx
---------------other aspx pages
 
B

Bazza Formez

I deleted cache.. no luck there.

1. yes, login.aspx uses the master page
2. login.aspx, master page * styles.css all in same directory
3. My directory structure is just as you have described....

Full structure (in case it helps) is :

root
-----web.config
-----web.sitemap
-----App_Code (asp.net folder)
---------------BLL directory
---------------DAL directory
-----App_Data (asp.net folder)
---------------mydb.mdb
-----MyDirectory directory
---------------styles.css
---------------masterpage.master
---------------login.aspx
---------------other aspx pages

By the way, all was working ok until I added the My directory level
into the mix and & moved web pages, master & styles.css into that.
 
A

Alexey Smirnov

By the way, all was working ok until I added the My directory level
into the mix and & moved web pages, master & styles.css into that.- Hide quoted text -

- Show quoted text -

I have really no idea what's wrong here.

Open your http://localhost/MyDirectory/login.aspx with no style, right
click - View Source. Check what was generated by ASP.NET. Make sure
that it is

<link href="/MyDirectory/styles.css" ...

Make sure that there no other CSS styles in use and HTML layout is
correct.

Try to save the source as a separated HTML file, e.g.
http://localhost/MyDirectory/login.htm to see if this work properly
with CSS in IE and in VS.NET.

Hope, it helps...
 
B

Bazza Formez

I have really no idea what's wrong here.

Open yourhttp://localhost/MyDirectory/login.aspxwith no style, right
click - View Source. Check what was generated by ASP.NET. Make sure
that it is

<link href="/MyDirectory/styles.css" ...

Make sure that there no other CSS styles in use and HTML layout is
correct.

Try to save the source as a separated HTML file, e.g.http://localhost/MyDirectory/login.htmto see if this work properly
with CSS in IE and in VS.NET.

Hope, it helps...- Hide quoted text -

- Show quoted text -

Thanks so much for your help Alexey. I very much appreciate it.
 
B

Bazza Formez

OK.. problem now solved.

It turns out that the permissions were all wrong. Using the security
settings of the website administration tool I was able to correct
access permissions to directories such that CSS file was no longer
protected to a user that had not yet logged on.
 

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

Top