 |
|
 |
Hi,
thanks for very good and simple solution of friendly url's. I have added it to my application and everything works fine until I put Context.RewritePath(Path.GetFileName(Request.RawUrl)); to page's Page_Load event. When I visit page with this code, I get page without styling. My stylesheets are in Theme in App_Theme folder and they are delivered to the page in Page_PreInit event: Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit Page.Theme = ConfigurationManager.AppSettings("theme").ToString End Sub Is there any solution to solve this problem?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Instead of the App_Theme folder, please try putting CSS files in just a plain folder called CSS in the root directory of your solution.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
ciao everybody! the example works very well... but i cant see the images and css file... because.. path dosent change.. can u help me??
thanks nicola
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Did you put those images and CSS in App_Theme folder? Please try moving them to a plain folder in the root directory of your solution.
Thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Why not use the open source project UrlRewriter.Net (see http://urlrewriter.net). We used it very successfully at the company I worked at previously even though the site tanked big time. (Google Capazoo if you want to read about drama, controversy and laughs)
Later, Nick
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | Question  Ashley van Gerven | 17:36 17 Jun '08 |
|
 |
Just wondering why the second Context.Rewrite is necesary in the Page_Load? You mention it's for Postback, but how does it differ from the first rewrite;
Context.RewritePath("~/ShowContents.aspx?ContentID=11"); .. Context.RewritePath("ShowContents.aspx");
Both calls are on Context object - is this a double up?
"For fifty bucks I'd put my face in their soup and blow." - George Costanza
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Do I need to do anything in IIS to put this working?
I'm always served with a 404 error page from IIS!
Thanks in advance, Adalberto
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I am contemplating using this on my site, has anyone used this and if so could you please provide some feed back and any issues you may have had. Would it be better to use this or the URL rewriter solution. My site is running in a web farm.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Nice article I face one problem while rewrite url when i rewrite url css and image is not apply on my page i also write step1 line on page load of my main page but it's not working can u please give my some solution i am working on .net 2005 so on my local server how to configure iis.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Hi thanks for the post.
I have been working on this for a few hours and was pleased to see someone else was working toward a solution. The key for me is getting all the other resources (css, js, images, etc.) to map with those resources having relative paths.
I made a small vs project using your files and got your code to work fine. The only problem (and it's a big one of course) is that it doesn't look like other resources like css files and image files will work if they have relative paths.
For example when I added an image to both the Default.aspx file in your sample and also the same image (with the same path) to the ShowContents.aspx file, the image link is broken in the ShowContents.aspx file when it is requested via the rewritten url.
I'm sure I'm missing something. Any help will be appreciated!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
1) If you start your image path with a forward slash like this "/images/abc.gif" it will work from root directory.
2) To use relative path you should also have configured your IIS to serve all requests from ASPNET.dll. and
3) You must have
System.IO.Context.RewritePath(Path.GetFileName(Request.RawUrl));
above line in the Page_Load() event of your main page.
If above does not help, please post your code here or email me.
Thanks for visiting this and leaving a comment.
Thanks
Manu Agrawal
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi GOD Bless you I have this in my dreams ASP.NET SEF URL is Very Easier Than PHP & Apache Never Forget you for this Article Thanks a Lot! Majid
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
|
 |
|
 |
Hi, Did you use the code in Step 1 above? Please try step 1 and then let me know if you still get problems.
Thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
well , i didn't do that before , now i did STEP 1 , but it still not working well .... i just want ot point out that im using masterPages , but i guess it does not matter
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
i have to end the request url with .aspx or .html ... etc ??
i saw some urls that look like that : www.abc.com/abc (not like www.abc.com/abc.aspx)
but it seems that global. don't get the request if it looks like this : "www.abc.com/abc " .
any idea ???
about the css problem , i just use the full path (http://www ....) not like ~/css/general.css ....
Thanks .
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Till IIS 6, only asp.net requests (e.g. .aspx, .ashs, .ascx etc.) reach to global.asax file.
If you have permissions then, you can set IIS to handle .htm, .gif etc. requests by the process that handles asp.net.
1) Open IIS admin and right click on the website you want 2) select Properties > Home Directory > Configurations 3) select the .aspx from the list, click on Edit, and then copy the process path. 4) Cancel 5) click Add then paste this path in to the top box 6) type .htm in the extension box, uncheck Verify File exists 7) Click OK
Repeat this process for any other file extensions you want like .doc, .ppt etc.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
You should check out also DotNetNuke's friendly url implementation as it provides nice framework for such functionality. One feature that I personally like is the fact that you can create a friendly url with custom parameters like "/Home/MyPage/para1/50/para2/hello" so that the "para1" maps with value of "50" and "para2" maps with value "hello" and they are accessible through normal Request.QueryString -object.
|
| Sign In·View Thread·PermaLink | 1.14/5 |
|
|
|
 |
|
 |
What if let's say you have a GridView with paging enabled and more than a page of rows in the GridView. In a "fake URL" page.
Now you will push on the "2"-nd page link on the GridView pager. Things will get a bit nasty then.. The Request will hold a different URL like "http://machine/fakeDir1/fakeDir2/ShowContents.aspx?querystring..."
I simply can't make it look nice (it works but after the first postback the URL in the browser looks ugly) after the first postback
|
| Sign In·View Thread·PermaLink | 3.67/5 |
|
|
|
 |
|
 |
Watch out if you have a validator in any of your pages because they will request a javascript throught the WebResource.axd and if in "Application_BeginRequest" you treat this as a fake URL the page will not get its javascript but whatever you serve it..
Take care as this took me 1/2 hour to figure out ..
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
For now I just put the following line in Application_BeginRequest event handler:
if (File.Exists(Request.PhysicalPath) || Directory.Exists(Request.PhysicalPath) || Request.AppRelativeCurrentExecutionFilePath.ToLower().EndsWith(".axd")) { return; }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |