472,985 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Strange HttpContext.Request.Url Problem

1
Hi,

This has got me really baffled.

This has got me really baffled. When I run Dim url As String = HttpContext.Current.Request.Url.AbsolutePath.ToLow er from Application_beginRequest in Global.asax with server that ships with Visual Web Developer everything works as expected.
However, today when I tried to move all code onto IIS server this just doesn't return the same URL!

On localhost (Visual Web Developer), variable url is /sandbox/my/home/page, but on IIS it returns /sandbox/index.aspx.

Yes, this is another HttpContext.RewritePath application which is why I need to know what the user types as a URL event though a 404 error is expected.

Let's say my root directory has only the following files:

* index.aspx
* web.config
* global.asax

When the user visits, for example: http://www.mysite.com/tutorials/tute/1

The global.asax file should be able to grab this URL using HttpContext.Current.Request.Url.AbsolutePath.ToLow er method and I will use this string to formulate a RewritePath to index.aspx?a=tutorials&tute=1.

As you can see, the directories tutorials, tute and 01 don't exist, so there is no index.aspx file to refer to.

My problem is, IIS and HttpContext.AbsolutePath isn't giving me http://www.mysite.com/tutorials/tute/1 or any of the variables. But the strange thing is, this is all working on localhost.

So it makes me wonder if it's something to do with IIS, or if there is another way to get the typed URL.


Any help is greatly appreciated.

Thanks,

Jason.
Jun 15 '07 #1
1 5117
Spanco
13
Hi ....

Just try a tiddle sign(~) in place of server.mappath and see what happened and please get back to me we both will solved it,waiting for response

Hi,

This has got me really baffled.

This has got me really baffled. When I run Dim url As String = HttpContext.Current.Request.Url.AbsolutePath.ToLow er from Application_beginRequest in Global.asax with server that ships with Visual Web Developer everything works as expected.
However, today when I tried to move all code onto IIS server this just doesn't return the same URL!

On localhost (Visual Web Developer), variable url is /sandbox/my/home/page, but on IIS it returns /sandbox/index.aspx.

Yes, this is another HttpContext.RewritePath application which is why I need to know what the user types as a URL event though a 404 error is expected.

Let's say my root directory has only the following files:

* index.aspx
* web.config
* global.asax

When the user visits, for example: http://www.mysite.com/tutorials/tute/1

The global.asax file should be able to grab this URL using HttpContext.Current.Request.Url.AbsolutePath.ToLow er method and I will use this string to formulate a RewritePath to index.aspx?a=tutorials&tute=1.

As you can see, the directories tutorials, tute and 01 don't exist, so there is no index.aspx file to refer to.

My problem is, IIS and HttpContext.AbsolutePath isn't giving me http://www.mysite.com/tutorials/tute/1 or any of the variables. But the strange thing is, this is all working on localhost.

So it makes me wonder if it's something to do with IIS, or if there is another way to get the typed URL.


Any help is greatly appreciated.

Thanks,

Jason.
Jul 9 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: adlaird | last post by:
Hi, I created a simple webform, put a test button on it and implemented a click handler that looks like so: private void btnTest_Click(object sender, System.EventArgs e) {...
0
by: John | last post by:
I'm trying to create a context object similar to the HttpContext that could be used by business objects independent of the origin or the call (ASP.NET or standalone). So I started out by...
0
by: theintrepidfox | last post by:
Dear Group I came accross a very annoying behaviour of Visual Studio, giving me six hours of headache till I found the solution. This post is mainly for fellow developers for reference as it...
5
by: Archer | last post by:
I was making a role-based authentication but it does't login with correct password. the HttpContext.Current.User recieved in Global.asax is always null. Request.IsAuthenticated is always false....
0
by: jensen bredal | last post by:
the code below works as expected when i'm doing localhost developpement on my win xp pro but when moved onto production server( windows 2003 server) and viewing from my win xp pc, then UserIndexA...
16
by: Victor | last post by:
I have a strange problem in my website. I configured my website to run under 2 worker processes. (web garden enabled). and I stored my user information in the current httpcontext(like...
2
by: f0zzyNUE | last post by:
hi everyone, currently we are testing the performance our application (asp.net based CMS) ... for that reason we wrote a "spider" that starts webrequests for all relevant pages which results in...
8
by: eric | last post by:
I have a 2.0 asp.net project. In a class contained within a seperate project, I am trying to reference HttpContext.Current.Session but Session is always null. I've tried implementing...
3
by: Brett R. Wesoloski | last post by:
I am having problems using HttpContext.Current.Request.Url.Host. I have some code that does this... if (HttpContext.Current != null) { subdomain = HttpContext.Current.Request.Url.Host; }
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.