CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 10/11/2007 5:41:05 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 11 Views: 45 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
12 Items, 1 Pages 1 |< << Go >> >|
Saavik
Asp.Net User
Page does not fully load masterpage when doing url rewriting10/11/2007 5:41:05 AM

0/0

I have a page that points to a masterpage, which has some links and images on it.

I am doing url rewriting using an httpModule.  So the address www.mysite.com/products would get rewritten under the covers to www.mysite.com/ps/main/products.aspx

 The rewriting is working fine, but when www.mysite.com/ps/main/products.aspx is loaded, it does not seem to properly load the references within the masterpage, such as .css and image files.

Any ideas?


Thank you,

================
Saavik
parth_192
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/11/2007 7:17:17 AM

0/0

on your page where ever you use images and other css...class...u need to make them runat server and give root path which start with "~/" ...

b'coz when ur url is change then when ever there is local path...then use ur rewirete url as root url and because of that path of those images are not found...

so make all images runat server and give path with "~/" same u can do in CSS...

rikishipabst
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/11/2007 7:28:43 AM

0/0

parth_192 is exactly right!  But this does not apply just for master pages.  I would use it for all of your pages where folders and levels could be an issue.  Visual Studio when selecting links by default will populate with the FQ Link starting with ~/Folder1/Folder2/File.aspx

Good Luck

Brent


Brent

http://www.brentpabst.com
http://www.pabstproductions.com
himanshu_hajari
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/11/2007 7:31:47 AM

0/0

Hi,

When You r using URL rewriting u have to be very careful for links and images and other paths

if ur using following type of path 

<img alt="" height="7" src="/Images/logo_bottombar.jpg" width="665" />

then place the

 <%=Request.ApplicationPath%>  before it so now your code will be

<img alt="" height="7" src="<%=Request.ApplicationPath%>/Images/logo_bottombar.jpg" width="665" />

U can do it for CSS also.

It can be helpful to u

 


From:
Himanshu Hajariwala
IF IT HELPS YOU THEN KINDLY PRESS THE "ANSWER" BUTTON.

The shortest distance between a problem and a solution is the distance between your knees and the floor.
The one who kneels to the Lord, can stand up to anything.


rikishipabst
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/11/2007 7:43:38 AM

0/0

Sure if you are using plain HTML controls.  I would suggest that you use the ASP.NET image control for images where the file path could get confused.  It you are having problems with CSS I recommend simply using Themes and throwing the CSS file in a theme folder.  ASP.NET will keep up with the CSS from there on.


Brent

http://www.brentpabst.com
http://www.pabstproductions.com
parth_192
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/11/2007 12:11:53 PM

0/0

Just declare all you css files in Master page and make then runat = "server" which is available for CSS files...so that will not create proble,.. 

Saavik
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/12/2007 2:28:45 AM

0/0

Thank you for your quick reply.

I was hoping for a quick fix as you suggested.  Unfortunately, neither css nor images worked.  Here is the part that did not make sense:

This did not work:

<link rel="Stylesheet" type="text/css" runat="server" href="<%=Request.ApplicationPath %>/Main.css" />

But this worked (here ApplicationPath is hard-coded as "/PS"):

<link rel="Stylesheet" type="text/css" runat="server" href="/PS/Main.css" />

Any ideas?

 


Thank you,

================
Saavik
Saavik
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/12/2007 2:30:52 AM

0/0

Thank you for your quick reply.

Please see my reply to rikishipabst above, as this situation is identical.


Thank you,

================
Saavik
parth_192
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/12/2007 4:44:02 AM

0/0

you can write this :

 

<link rel="Stylesheet" type="text/css" runat="server" href="~/(path from root to main.css file )"/>


Saavik
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/12/2007 7:26:54 PM

0/0

Thank you for your quick reply.

Main.css is at the root folder, same as the masterpage.  So href="~/main.css" should work, but does not. Again, hardcoding the AppPath like this- href="/Ps/main.css" makes this work, but of course I do not wish to hard-code the application path.

Any ideas would be appreciated.

 


Thank you,

================
Saavik
rikishipabst
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/13/2007 8:41:58 PM

0/0

Saavik,

I used:

<link id="Link1" rel="Stylesheet" type="text/css" runat="server" href="~/main.css" />

and it worked just fine.  When you load the page View the Source in the browser.  If indeed ASP.NET is loading the StyleSheet location then the problem may not be with ASP.NET but rather when in the Execution Cycle it is populating the href portion of the tag.

 It could also be your lack of giving the Tag an ID.  You tell the code to runat the server but without an ID specified the server cannot render the tag correctly.

Let me know what you get!

Brent


Brent

http://www.brentpabst.com
http://www.pabstproductions.com
Saavik
Asp.Net User
Re: Page does not fully load masterpage when doing url rewriting10/14/2007 1:53:35 AM

0/0

Thanks for your idea.

I added id that was not there before, and still not working.  In fact, the generated source says:

href="../main.css" - this was a real surprise.

Masterpage resides in the root folder, as does main.css.  Masterpage refers to main.css.

The actual page that is built over the masterpage resides in a folder one level down (i.e., ~/Main/Mypage.apsx).

I feel clueless - any ideas?

 


Thank you,

================
Saavik
12 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Solved!: setting base in Head of master page from content page for ... The problem was after trying to do some of the things in Scott G's article on the URL rewrite with the master page, ...
Unable to Perform Url Rewriting Correctly - ASP.NET Forums I have a very Peculier Problem with Url Rewriting. .... Unfortunately, I do not have any experience with the master page and content page ...
Dynamically Loading Master Pages in ASP.NET 2.0 However, in the case where you want to load the master page dynamically, ... for Url ReWriting you are bound to find something useful on the subject. ...
TheMSsForum.com >> Asp >> Calling js file from Master page - The ... I am also using a master page although the printed web page does not use it. .... I'm looking for URL Routing or URL Rewriting solutions. ...
SQL Project: Load and Display Page Contents Asynchronously with ... And this page does not know anything about the parent page. ... When I access the page without doing url rewriting, the page loads fine, and your component ...
Life Of A Subtext Request Since the request we are following does not match any of the first five ... TEXT wrote up a short description of this technique of URL Rewriting here. ...
Semantic URL's in MOSS 2007 (Imtech SharePoint Semantic URL's free ... In order to have your URL's being picked up by the URL rewriting engine, ..... Waldek Mastykarz: @Richard: the master page error you got earlier resembles a ...
Enterprise .NET Community: More Than One Way to Skin an App The “default.aspx” will load the master page skin and then use the requested URL to load the appropriate control in the content area. If you were not ...
A Complete URL Rewriting Solution for ASP.NET 2.0 On Production server the images of mapped url page is not showing. .... NET will return its 404 error page (or your custom 404 page), doing extra work for ...
Templated Pages using RewritePath and User Controls Load user controls dynamically into a master page by parsing out control name .... the URL and "Rewrite" the path as IIS does not pass the request to ASP. ...




Search This Site:










scheduler exception! is there no fix? please??? anyone???

onselectedindexchange

multiple matser pages using a common code base?

how to open a webform on designer !

divide and conquer with membership, roles, and profile providers

update username in membershipuser

some error when upload on server

when will microsoft take asp.net security seriously?

i got it!

where is the theme gallery?

how to write in asp and asp.net

connecting to web service error - aspnetdb.mdf

is it possible to pause the login process for data entry?

page expires after two postbacks and linking to editpage

visual web developer 2008 data connection problem

sys.webforms.pagerequestmanager timeoutexception : the server request timed out

speerio newswire -- free module for managing portal rss feeds

how to handle "wait page" for long running process

exchange sals for 2005 and corp web access

decrease the size of textbox

error occurred writing to the exception log

is dnn the best solution for custom functionality?

dnn skin modification wanted quick - easy project pays $150

quite tired of working alone

how can i get a weblogs.asp.net account?

treeview control and xml

simple question about treeview

error while accessing sql server 2005

modify web.config?

problem in search input module of dnn 3.0.11.

 
All Times Are GMT