473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

RewritePath issues

Hello all,

I'd like to have personalized URL's in my application. For example,
http://mydomain.com/sites/page.aspx should be accessible via
http://mydomain.com/sites/username/page.aspx. I'd like to parse the URL and
grab the username so I can deliver the appropriate content on the page. This
seems to be accomplished by the HttpContext.RewritePath method. I've read
that ASP.NET uses it to strip out the SessionID when cookieless sessions are
turned on.

Unfortunately, the RewritePath method seems to only affect the filename
portion of the URL. For example, I can strip out the username and append it
to the end of the URL in the form
http://mydomain.com/sites/username/p...eter1=username, but the
username still remains in the URL, resulting in a 404 error.

Any insight is much appreciated.

--
Corey O'Mara
MCSD.NET, MCT

Nov 18 '05 #1
2 1720
You should be able to do exactly what you are aiming to achieve using
rewritepath, we use this method in our cms with no such issues. Please post
the code used to perform the rewritepath, and I'll have a look.

Matt
http://www.3internet.co.uk

"Corey O'Mara" <co***@homnick.com> wrote in message
news:eN**************@TK2MSFTNGP10.phx.gbl...
Hello all,

I'd like to have personalized URL's in my application. For example,
http://mydomain.com/sites/page.aspx should be accessible via
http://mydomain.com/sites/username/page.aspx. I'd like to parse the URL and grab the username so I can deliver the appropriate content on the page. This seems to be accomplished by the HttpContext.RewritePath method. I've read
that ASP.NET uses it to strip out the SessionID when cookieless sessions are turned on.

Unfortunately, the RewritePath method seems to only affect the filename
portion of the URL. For example, I can strip out the username and append it to the end of the URL in the form
http://mydomain.com/sites/username/p...eter1=username, but the
username still remains in the URL, resulting in a 404 error.

Any insight is much appreciated.

--
Corey O'Mara
MCSD.NET, MCT

Nov 18 '05 #2
Hello Matt,

What I'm seeing is that it's not the code itself, but rather the location
of the code.

In my development environment (WinXP laptop), I'm using localhost/appname.
Underneath that dir is the sites subdir with the appropriate aspx files
inside.

here's the request: http://localhost/appname/sites/username/page.aspx
here's the rewrite:
http://localhost/appname/sites/page....rname=username

If I put the code in the global.asax in the localhost/appname dir, I can
only rewrite the path up to the aspx file itself. However, if I place the
code in the root of the website (default web site, c:\inetpub\wwwroot), it
will intercept the request before ir gets to the app so I have complete
control over the whole path. I'm stripping out the username and redirecting
to "localhost/appname/sites/page.aspx?username=username"

Unfortunately, this severly affects Forms Autneication. I want to have a
web.config file in the root of the app, but I get an error that it's invalid
to have a declartion beyond "machine to application." It's the one that
signifies that the virtual directory is not setup as an application in IIS.
Never mind the fact that it is configured as an application, I think I can
make things work if I put the web.config in the root of the server, just
like the global.asax.

I've gotten the redirection to work, but now I'm getting "Could not load
type" errors on the pages I'm redirecting to.

Part of my problem (I think) is the folder structure. Is there a way to
point VS.NET to the root of the webserver rather than using a subdir?
--
Corey O'Mara
MCSD.NET, MCT

"matt" <gr************@hitscricket.com> wrote in message
news:RS*********************@stones.force9.net...
You should be able to do exactly what you are aiming to achieve using
rewritepath, we use this method in our cms with no such issues. Please post the code used to perform the rewritepath, and I'll have a look.

Matt
http://www.3internet.co.uk

"Corey O'Mara" <co***@homnick.com> wrote in message
news:eN**************@TK2MSFTNGP10.phx.gbl...
Hello all,

I'd like to have personalized URL's in my application. For example,
http://mydomain.com/sites/page.aspx should be accessible via
http://mydomain.com/sites/username/page.aspx. I'd like to parse the URL

and
grab the username so I can deliver the appropriate content on the page.

This
seems to be accomplished by the HttpContext.RewritePath method. I've read that ASP.NET uses it to strip out the SessionID when cookieless sessions

are
turned on.

Unfortunately, the RewritePath method seems to only affect the filename
portion of the URL. For example, I can strip out the username and append

it
to the end of the URL in the form
http://mydomain.com/sites/username/p...eter1=username, but the username still remains in the URL, resulting in a 404 error.

Any insight is much appreciated.

--
Corey O'Mara
MCSD.NET, MCT


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matt Howeson | last post by:
Some time ago I posted a request for help with a problem I was having sometime ago whereby a 404 error would result if any access to the Querystring had been made before the Context.Rewritepath is...
5
by: Guadala Harry | last post by:
I'd really appreciate it if someone would give me a"plain English" explanation of HttpContext.RewritePath(). I read the MSDN documentation, but still don't understand it. According to MSDN:...
8
by: Jiho Han | last post by:
Can someone explain in layman's term, what HttpContext.RewritePath does? SDK doc explanation is kind of scant. Does it only affect the request processing for the duration of the processing(meaning...
1
by: Oytun YILMAZ | last post by:
Hi I thing I have found a critical bug about ASP.NET ReWritePath Function Here are the steps to reproduce: I have a solution with this items: "MasterPageWithoutUserControl.aspx"...
15
by: James Higgs | last post by:
For a long time, our product has had a "vanity URLs" feature where nice URLs are mapped to ASPX files in an IHttpModule implementation, using HttpContext.RewritePath(). This has worked beautifully...
3
by: asanford | last post by:
I want to create an ASP.NET web application that receives a form POST message, inspects the data, and reroutes the request to one of many different servers. I wrote an IHttpModule which...
0
by: cpnet | last post by:
I was playing around with Beta 2 of VS2005, .NET 2.0, and built an IHttpModule do allow me to have nice URL's in my web app. It was working great. I had a URL like: ...
0
by: Massimo Necchi | last post by:
Hi everybody, I'm developing a simple web site for a friend of mine and I need an help for the folloeing situation: I am planning to map friendly page name (like '/faq.aspx') to more complicated...
1
by: Keef | last post by:
Hiya... just wondering if anyone else has come across this problem, and if there is a solution... i'm writing a reasonably simple IHttpModule to rewrite URLs ... in the BeginRequest event i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.