473,563 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Rew ritePath 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 1729
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******** ******@TK2MSFTN GP10.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.Rew ritePath 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\wwwr oot), 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?usern ame=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.co m> wrote in message
news:RS******** *************@s tones.force9.ne t...
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******** ******@TK2MSFTN GP10.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.Rew ritePath 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
2251
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 called. (http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=66a19 d98.0212240627.3f123293%40posting.google.com) I have...
5
2735
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: .... assigns an internal rewrite path. RewritePath allows for the URL that is requested to differ from the internal path to the resource. What does...
8
1839
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 server side), or is the client in anyway affected? Thanks
1
3105
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" "MasterPageWithUserControl.aspx" "OrdinaryPage.aspx"
15
6696
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 for the past couple of years under .NET 1.1, but when it runs under ASP.NET 2.0 it has problems. Note that this is the case regardless of whether...
3
2920
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 successfully used HttpContext.RewritePath() to send a request to different pages in one web application, but it gives me an error when I try to rewrite a path...
0
1429
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: http://mydomain.com/Users/BobSmith/ or http://mydomain.com/Users/BobSmith The "BobSmith" didn't actually exist. My HttpModule would use RewritePath method to return a...
0
964
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 ones (like '/displaypage.aspx?id=1'). I've done an internet search and I found that I can achieve this using httpModule. My first attempt was to...
1
3458
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 do a app.Context.RewritePath("~/"+theFile,false) to the aspx file to display the content, then in the PreRequestHandlerExecute i do another...
0
7659
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.