Solved

Create new .aspx file?? Lost

Posted on 2010-08-27
96
668 Views
Last Modified: 2012-05-10
Hello All;

I am new to asp.net to a point, I can work the stuff that I have
But when it comes to creating new documents without being hand-held
I get off my game.

I am following the information on this page here:

http://knowledgebaseworld.blogspot.com/2008/09/extended-url-rewriting.html
(Just found out that the code is for C#, I used http://converter.telerik.com/ to convert to VB.NET)
The code (Supplied below)

Is where i am having my problem.
How do I create this document?
What all extra code needs to go to the page in order for it to work, without error?

Thank You
Carrzkiss
Protected Overrides Sub OnInit(e As EventArgs)



	If Request.Url.ToString().Contains("404;") Then

		Dim urlInfo404 As String() = Request.Url.Query.ToString().Split(";"C)



		If urlInfo404.Length > 1 Then

			Dim strRequestUrl As String = urlInfo404(1).Replace(":" + Request.Url.Port + "/", "/")



			If Not strRequestUrl.EndsWith("/") Then

				strRequestUrl = strRequestUrl.Insert(strRequestUrl.Length, "/")

				Response.Redirect(strRequestUrl)

			End If

			Dim urlInfoFavAddress As String() = strRequestUrl.Split("/"C)

			Dim strUser As String = urlInfoFavAddress(urlInfoFavAddress.Length - 2)





			Server.Transfer(String.Concat("~/Profile.aspx?usr=", strUser))

		End If

	End If

	MyBase.OnInit(e)

End Sub

Open in new window

0
Comment
Question by:Wayne Barron
  • 52
  • 23
  • 16
  • +1
96 Comments
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I updated the code.
Converted it from C# to VB.NET which it what I am using on my site.

Thank you for any help.
Carrzkiss
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I just realized something.
If I use this method then I will loose my ability to detect pages, images, files
That are no longer valid on the server.
Is there another way of doing this (or) a way to still detect the missing items
And still do redirects if the url is accurate.

(I cannot install anything on the server, so I need a way to doing URl Rewrites
So that the member of the site can have their username as their URl
site.com/username
And they are in)

Thanks to anyone with information on this.

Carrzkiss
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- This is not a good way to perform URL Rewrite in ASP.NET, take a look at: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx Approach 3: Using an HttpModule to Perform Extension-Less URL Rewriting with IIS7, change the <rewriter> to the code i have uploaded below, but i suggest you change to www.yoursitename.com/User/YourUserNameHere instead of www.yoursitename.com/YourUserNameHere
//For www.yoursitename.com/YourUserNameHere
<rewriter>
    <rewrite url="~/(.+)" to="~/Profile.aspx?usr=$1" />
</rewriter>

//For www.yoursitename.com/User/YourUserNameHere
<rewriter>
    <rewrite url="~/User/(.+)" to="~/Profile.aspx?usr=$1" />
</rewriter>

Open in new window

0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Forgot to mention
Using IIS5
Not IIS7, sorry...

Any other idea's?
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- So, try to add  Application_BeginRequest event in Global.asax file
void Application_BeginRequest(object sender, EventArgs e)
    {
        //URL example: www.site.com/User/UserName
        string url = Request.Url.ToString();
        if (url.Contains("/User/"))
        {
            return;
            //Get the username
            string[] temp = url.Split('/');
            string userName = temp[temp.Length - 1];

            //Redirect
            Context.RewritePath("/Profile.aspx?usr=" + userName);
        }                      
    }

Open in new window

0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Sorry, but you need to remove the return; statement below the if (url.Contains("/User/")), my bad :(
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
ok.
How do I create the Global.aspx file?
Also.
Is there a way to NOT have to have /user/ within the url?
Would prefer to just have: site.com/username
I have been reading up on: Request.RawUrl
Is there a way to use it to catch
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
what I mean by how do I create it, I mean:
How to start it?
As I know something else needs to be added instead of just the code you provided.
This is what I have
<script language="vbscript" runat="server"> 

void Application_BeginRequest(object sender, EventArgs e)

    {

        //URL example: www.site.com/User/UserName

        string url = Request.Url.ToString();

        if (url.Contains("/User/"))

        {

            //Get the username

            string[] temp = url.Split('/');

            string userName = temp[temp.Length - 1];



            //Redirect

            Context.RewritePath("/Profile.aspx?usr=" + userName);

        }                      

    }



</script>

Open in new window

0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Right click to your web site, choose Add New Item..., then choose Global Application Class
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
OK.
Did that, now where does the code go that you provided?

<%@ Application Language="VB" %>



<script runat="server">



    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

        ' Code that runs on application startup

    End Sub

    

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)

        ' Code that runs on application shutdown

    End Sub

        

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

        ' Code that runs when an unhandled error occurs

    End Sub



    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)

        ' Code that runs when a new session is started

    End Sub



    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)

        ' Code that runs when a session ends. 

        ' Note: The Session_End event is raised only when the sessionstate mode

        ' is set to InProc in the Web.config file. If session mode is set to StateServer 

        ' or SQLServer, the event is not raised.

    End Sub

       

</script>

Open in new window

0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
@thaytu888888
Could you please let me know what I need to do next?
I would really like to test this script out to see if it is going to work.

Carrzkiss
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Add them inside <script runat="server">
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I am still learning the differece between VB and C# So when I pasted your script into the global.asax file, it gave a LOT of underlined errors.

I had to convert it over to VB, and once I did that, no more errors.

I tested
site.com/User/username

And I am getting the 404 - page cannot be found.

What else do I need to do to make this work?

(The Converted VB.net code is provided below)

Thank You
Carrzkiss
Private Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)

        'URL example: www.site.com/User/UserName

        Dim url As String = Request.Url.ToString()

        If url.Contains("/User/") Then

            'Get the username

            Dim temp As String() = url.Split("/"c)

            Dim userName As String = temp(temp.Length - 1)



            'Redirect

            Context.RewritePath("/Profile.aspx?usr=" + userName)

        End If

    End Sub

Open in new window

0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Hmm, replace Context.RewritePath("/Profile.aspx?usr=" + userName) with codes below

Server.Transfer("/Profile.aspx?usr=" + userName)

Open in new window

0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Still nothing.
Is there anything that needs to be put in the web.config file or anywhere else?
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Look like the root cause is Context.RewritePath("/Profile.aspx?usr=" + userName)
 it should be Context.RewritePath("~/Profile.aspx?usr=" + userName) if the Profile.aspx is under the root folder.
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility

void Application_BeginRequest(object sender, EventArgs e)
    {
        //URL example: www.site.com/User/UserName
        string url = Request.Url.ToString();
        if (url.Contains("/User/"))
        {
            //Get the username
            string[] temp = url.Split('/');
            string userName = temp[temp.Length - 1];

            //Redirect
            Context.RewritePath("~/Profile.aspx?usr=" + userName);
        }                      
    }

Open in new window

0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
And nope again.

Listen, I am running test on an IIS5 WinXP system.
I will be upload to a server running IIS5 as well (Win2k3 Server)

Can you please test the code on your end, and make sure that it works, then send me over a fully working code page?

That will be a lot better than what we are doing here, which is not really accomplishing much of nothing except possibly wasting each others time with code that does not seem to be working.

I have tested everything that you have sent over and nothing is working thus far.

Please, test on your end and send over working code..

Thank You
Carrzkiss
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Rename the Global.cs to Global.asax (cuz EE server doesn't allow me to upload file with asax extension), work great on my computer.
WebSite2.zip
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Not working
http://ee.cffcs.com/Q_26433690/User/carrzkiss/

What are you testing with?
Are you doing something different in IIS?
What version of IIS are you using?
What version of Windows are you testing with.

There is something different between my system, our hosting server and your system
If it is working on your end but not on ours...
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Would you pls provide me the error message?
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- I'm using II6, VS 2008 - ASP.NET Web Site, Win XP, but just give me the error message
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Click on the link above, and you will see the error that I am seeing

404  The page cannot be found

There is no other error available.

WinXP runs IIS5 not IIS6
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- OK, IIS is not the problem here, do debug in Application_BeginRequest function and tell me what happened (make sure you rename the Global.cs to Global.asax, or add a new Global.asax and copy the content from the Global.cs). We are almost done but somethings went wrong and we just need to find out.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
How do I do the debug?

I am very new to aspx, so please be patient with me on this.
What do I add to do the debug?
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
OK, I got it to write my username to the page.
BUT, That is only within VS2008

How come I cannot get it to work through IIS?
http://192.168.2.9/User/carrzkiss

0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- OK, your solution for IIS5 is here: http://www.experts-exchange.com/Programming/Languages/.NET/Q_21413788.html#a14123965

- "The problem is a setting on IIS that checks if a file exists before calling Application_BeginRequest.  If this option is set ON,  IIS will throw a 404 error and not fire the Applciation_BeginRequest event.  If it's off,  the event is fired.

This is a setting in IIS:
IIS/Website/Properties/Home Directory/Configuration/Mappings/.aspx/Edit

In IIS6,  Change the setting "Verify that file exists" to OFF
In IIS5,  Change the setting "Check that file exists" to OFF

End of problem."
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- Open IIS: Start menu -> Run...-> type: inetmgr then click OK
iis.JPG
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
It is already set to OFF

So, that will mean that
>> End of problem."
Unfortunantly, not....   :~(
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Also.
The link that I sent to you is from our Hosting Server, not from my machine.
So, it has to work on that machine, and it is "hopefully" setup to work properly.

Any other idea's???
I have been searching google for information on:

{site works in Visual Web Developer 2008 but not in iis5}

One place said to set the Virtual Directory as an [Application]
I did that, and still nothing.

Going back to do some more checking.
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
nothing.
As you can see, testing it out yourself, it does not work.
That link is not hosted on my machine, so, if it does not work, it does not work,....

Any other thoughts?
0
 
LVL 6

Expert Comment

by:thaytu888888
Comment Utility
- I just tested and it worked in a computer with Win XP + IIS 5, so can you check the IIS settings on the hosting server?
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Will have to email them to see.

Why want it work on my system?
It is as listed above, so, it should be rights, work on my system as well.

I will send a message over and see what they say.
Will not get a reply back for a day or so.
Will post back my findings.

Until then, I have opened another question, in hopes that someone may be able to assist as well
http://www.experts-exchange.com/Q_26438056.html

It is regarding everything that we have tested here.

I am going to get some rest, if you can think of anything, please post here
Unstead of the other thread.

Thank you
Carrzkiss
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
This is what I sent over to my Hosting Provider.
Going to get some rest now, or at least try too.

==================================

I need to know if this setting is set on my site. (Within IIS)
I am doing a URL ReWrite on the site, and it is not functioning, so please let know if this is set?
If it is not set, can you please set it for me???
Thank You

Instructions.
This is a setting in IIS:
IIS/Website/Properties/Home Directory/Configuration/Mappings/.aspx/Edit
(If this is checked, please UNCHECK it...)
In IIS6,  Change the setting "Verify that file exists" to OFF
In IIS5,  Change the setting "Check that file exists" to OFF
==================================
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Hi there

The first part of your problem is that your page is called default.aspx and IIS 5.0 is expecting the default page to be called something like default.asp or index.htm.  You need to go into Internet Information Service Manager, right click on your site and add "default.aspx" as your default document.  You can delete the other default document names.

If you want to verify this, go to http://ee.cffcs.com/Q_26433690/User/carrzkiss/default.aspx (note the default.aspx on the end)

Now at least you can see an ASP.NET error message, rather than the IIS page not found message.

As you will now see, there is an error preventing ASP.NET from loading the page.  You should now follow the instructions on the error page and edit your web.config file to switch CustomErrors to Off.  Once you've done that, reload your page in the browser and you will see the full error message.  Either post the whole error message into your next comment, or let us know when you've made the change and we can then revisit your page and see the error for ourselves.  We will then be able to guide you in what you need to do to fix the actual error.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I was so hoping, but unfortunantly.
Default.aspx
Is default for IIS5.1
And it set on my system and on our hosting server.
So, unfortunantly, your theory as much as I wanted to be accurate, is not.

Thanks for the try that, it was a good one.

Carrzkiss
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Carrzkiss,

If you browse to http://ee.cffcs.com/Q_26433690/User/carrzkiss/default.aspx you can now see a more helpful error message: "Only one <configSections> element allowed per config file"

Can you edit web.config and check if you have more than one section called <configSections> and if so delete one of them?
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
And the error that the page gives after adding the in the
>>   <customErrors mode="Off"/>
is

>> The resource cannot be found.

Using the string
>>  User/carrzkiss/default.aspx

Removing the User/carrzkiss/
From it, it displays a solid page.

So, there is something missing somewhere
Either in IIS or somewhere else.
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
From here, I was able to see a proper ASP.NET error message, which was about removing the duplicate section from your web.config.  You need to do that...

I can no longer view your page - I get "resource cannot be found" - what did you change?  Did you delete the page!  Change it back!
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Yes, that was a few minutes ago.
I already fixed that.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I added in the information that it said, to the web.config file.

The error message is:



  Server Error in '/' Application.

The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /EE/Q_26433690/User/carrzkiss/default.aspx

Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3614


------------
It is basically saying the it cannot find the file in the location that you soecified AS
It is not there. it is only here

http://ee.cffcs.com/Q_26433690/default.aspx

This
http://ee.cffcs.com/Q_26433690/User/carrzkiss

Suppose to work as a URLRewrite
But, it is not working.
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Ok, then what I think is happening is that your code is suddenly starting to do its thing, and the URL rewriting is happening, and the page that is being redirected to does not exist.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Can't be.
Try this
http://ee.cffcs.com/Q_26433690/User/carrzkiss

This is the URL that is suppose to work, but it does not work.
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
I still believe that http://ee.cffcs.com/Q_26433690/User/carrzkiss or http://ee.cffcs.com/Q_26433690/User/carrzkiss/ is still giving you an IIS error, because default.aspx is not the default page.

If you view http://ee.cffcs.com/Q_26433690/User/carrzkiss/default.aspx you get a different error - I think it is because your code is running but not working
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Here are the two errors.  The first is returned by IIS.  The second is returned by ASP.NET.

You are getting the IIS error when default.aspx is not specified.
IIS-erro.PNG
ASP.NET-error.PNG
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Yes, I understand all of this.
That is what we are trying to figure out now, as to WHY it is not showing up.

OK.
I tested the sites within VWB2008, and it WORKS!
BUT not in IIS.
So.
What could there be?

I just went onto my system (WinXP IIS5.1)
And set that directly for default document as ONLY  Default.aspx
And then tested it. Still Nothing.

So, it is NOT that, unfortunantly.
So, there has got to be something else that we are missing.
If it works within VWD, then why will it not work within IIS?
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Lets go back to basics.

Can you create a test file called test.htm and type something in to it.  Save the file to the root of your web site on your XP machine.  Also upload a copy to the root of your web site on your hosted site.  Browse to http://ee.cffcs.com/Q_26433690/User/carrzkiss/test.htm and to the equivalent on your XP machine and make sure both pages display ok.

Then repeat the exercise with the following code saved to test.aspx
<%@ Page Language="VB" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<script runat="server">



</script>



<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Hello</title>

</head>

<body>

<h1>Hello</h1>

</body>

</html>

Open in new window

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Can you enable logging for your IIS site, try loading your page and see what appears in the log?  What page if any appears in the log when you browse http://192.168.2.9/User/carrzkiss/default.aspx (and what HTTP is the return code)?
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I do not think that you are understanding here.

There is no Folder /User
There is no Folder /carrzkiss

In this case, the only folder is: /Q_26433690/
Of which the files reside within.

It is not going to find something that is not there.

If you want me to try something, by all means, pass it along.
But, please understand.

What we are trying to do here is make it so that users can type in their Username
And the page gets redirected to their profile, instead of
/page.asp?id=1
Would be (In this case, with the code that was provided)
/User/carrzkiss
And that in return is suppose to redirect the user to the page.
NOW.

As mentioned, if there is something that you want me to try, I will.
BUT, without having to create the physical folders for /User/carrzkiss
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Here is your test file
http://ee.cffcs.com/Q_26433690/testMe.aspx

There is already a page called test.aspx
Of which is suppose to work with the redirect.

I even added in the test.aspx to my IIS, and still did not work.

http://ee.cffcs.com/Q_26433690/test.aspx
(You will get an error on this one, as it it hunting for: /User/
Within the URL
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
I have not asked you to create any physical folders - I suggested you created some test pages.

You yourself suggested this was an IIS problem rather than an ASP.NET problem (as you have it working in the Visual Studio web server) so what we need to do is identify why your IIS server is giving you a problem.

This is basic troubleshooting stuff... I know you are a Sage.  I am trying to help here... if you don't want help, I'll direct my efforts elsewhere...?
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I did not say anything about my EE Statistics, and they have absolutely nothing to do with anything in this post.
As for your help, I welcome it.
It just seems that something is a miss, and either I am not fully understanding your information or you are not fully understanding mine.

I am not getting upset, I am just pointing out.
#1: http://ee.cffcs.com/Q_26433690/User/carrzkiss/testMe.aspx
Does not work,
Tested within VWD (WORKS!)

#2: http://ee.cffcs.com/Q_26433690/User/carrzkiss/testMe.htm
Does not work.

-----------
I am sorry if I came off a little rough on the edges.
I understand that you have been doing asp.net since its start.
I am new to it, so try to explain things a little more, so that this "SAGE of ASP Classic"
Can catch on a little better.

If it is NOT IIS, that is causing the issue, then what is?
I feel that IIS is the issue, but that is because it works within VWD
But, then again, I do not understand how VWD works on its on server
What is there that is different from IIS?

Thanks for your help thus far.
Just try not to get upset over my not quite understanding what the heck is going on.

Carrzkiss
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Visual Web Developer uses its built-in web server "Cassini".  See http://msdn.microsoft.com/en-us/library/58wxa9w5(VS.80).aspx

It is quite common for a site that works fine in Cassini to not work in IIS, due to many things such as permissions, IIS settings etc.

Incidentally, Microsoft will shortly release IIS Express which is a version of IIS7 that will run on desktop OS including XP...
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
That will be nice.
But, the only downfall is that my hosting server, still uses win2k3 iis 5 or whatever it is.
So, if I was to get something to working in the IIS7, it may and may not function properly in their IIS.
(Microsoft really needs to stop all the messing around with their software)

Any other idea's on what can be tested?
If it is not IIS, then what else can be tested with the asp.net part of it?
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
In Visual Web Developer (I presume this is not the "Express" edition) you can place a breakpoint in your code and then (from the Debug menu) attach to the instances of IIS (inetinfo on XP, w3wp on newer OS) that you are running.  You can then step through your code when you load your page in your browser.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
This is Express 2008
How exactly and where would I place the breakpoint.

And how would I attach it to IIS?

(I am going to step away for a few hours but will be back to test)
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
You may also have to attach to aspnet_wp.exe (http://geekswithblogs.net/vivek/archive/2006/10/18/94436.aspx)

You would place your breakpoint on the first line of your own code, so in Application_BeginRequest in global.cs or Page_Load in test.aspx.cs etc.

If you only have Express the "attach to process" option does not exist (http://msdn.microsoft.com/en-us/library/c6wf8e4z(v=VS.90).aspx) - instead you will need to change your web server settings within VSWD to "Use local IIS web server"
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Place the breakpoint by clicking on the line of code and then press F9.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
>>  instead you will need to change your web server settings within VSWD to "Use local IIS web server"

How do I do this?
I have searched the menu options and cannot find where I would need to do this at
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Right click on your project in the solution explorer, select properties.  Then there should be a dialog box with tabs down the left hand side.  The bottom tab should be "web".  It would be on there.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
My da*n hosting company will not do crap.
I just got off the phone with them and chewed the guy out.

The only thing that I am going to be able to do is see if I can work around their sh*t.

I feel like eating nails right now...
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
This is what I am showing.
Would I choose cutom web server and type in the physical address to IIS?
VWD.jpg
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Hmm, Microsoft must have taken away that option in the Express edition.  It is worth trying "use custom server" and typing in the URL of your local IIS site into the Base URL box.  Then having placed breakpoints, click the run button and see if the breakpoints get hit.

If that doesn't work - is upgrading to a full version an option?
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I set the URL up, and I set the Start Page.
I have IIS setup like it specified within the Help for Debugging.
[Create] under Configuration.

When I run the page, I get this error.

---------------------------
Visual Web Developer 2008 Express Edition
---------------------------
Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
Click Help for more information.
---------------------------
OK   Help  
---------------------------
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
@HairBrush

Microsoft has a 90 day full trial of their professional version of the VWD2008
I downloaded all 3.65Gb of it as well as the SP1 that goes with it.
I am not going to install it right now as I have to finish up what I am doing right now
Then I have to do a reinstall of the system, as I have really beat the he** out of it with
The development of my site these last few weeks.

(I reinstall at least once every 1 - 2 months, it is something that I actually look forward to doing, Takes about 5-7 hrs of my day away, but by the time I get started back up, I feel refreshed, been doing it like this for over 5 yrs now, this laptop has been reinstalled over 100+ times since I bought it in 2004-05
2.66gb processor and 2gb ram 126gb internal hd and 1tb worth of external drive space.)

I will get back with you once I have the pro version installed and running.

Take Care until then.
Carrzkiss
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Did you think about using a product like Norton Ghost to enable you to easily re-image your machine back to a known clean state?  Alternatively you could look at virtualization and undo disks - that is what most developers use these days...
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I have thought about it yes.
Re-doing my system is something that for some strange reason, I actually look forward too.

BUT, Do you perhaps know how long it takes to restore the image?
For example, on a 20GB drive that has 51% space used?

Depending on how long it takes, will depend on rather it is worth while for me to do it or not.

But thinking about it...
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
OK, I have VWD 2008 Pro
Insteall. (Never got a change to reinstall the system, so this is a quick test run of the new program.)

Since I am using the pro, could you please assist with detailed instructions on how to do the debugging through IIS with VWD?

Thank you for your time in sticking with me on this issue.
Carrzkiss
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Ok - with your project open in VWD 2008 Pro, set a breakpoint on a line of code that you know will be executed, before the bit of code that is giving you the problem, i.e. Protected Overrides Sub OnInit(e As EventArgs).  To set the breakpoint, click on the line and press F9.

Then browse to your IIS site using IE.  Now when you click the Debug menu and select "attach to process" you should see aspnet_wp.exe.  Click on this and click Attach.  The breakpoint symbol to the left of the line of code should be solid red.

Now refresh your page in your browser.  Does the debugger now highlight the line of code that you set the breakpoint on?
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
So extremely late to reply back to you.
Had to get some rest, and still fill bad..

OK.
When I ran the debug, I received the following error.
(I had to go to the test.aspx page to copy it down, as the error dialog showed all the html source around the error, which I am pretty sure you are aware how it looks and works)

This is taken from the test.aspx file.


Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request.

I am going to research this error and see if I can resolve it so that I can continue tested.

1 more thing.
When you stated:
=====
Now when you click the Debug menu and select "attach to process" you should see aspnet_wp.exe.
=====

When I click on the Debug menu, I am not given the option to: attach to process. ??
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Rebooting the computer fixed the error messages that I was receiving.
Going to try your instructions again.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
OK.
I had to reset the IIS HTTP Keep Alive, in order to debug within VS

OK, I Debug and it loads the page
http://192.168.2.9/ee/Q_26433690/User/carrzkiss/Test.aspx

I step through and it writes
Test.aspx
to the page.
BUT, It will not run just    /User/carrzkiss

So, at least we are getting somewhere with it.

(I had to uncheck HTTP Keep Alive, because the system is so screwed up right now, that I am only able to have 2 pages opened at a time showing my local sites running... Never experianced this issue before, but found out a work around was to uncheck keep alive
So, that is what I have been doing in order to work on my sites.)

ok.
Going to work on another issue until you get back with me on what to do next.

Carrzkiss
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
When I remove the test.asp from the address
And just have /User/carrzkiss
And run it while in debug mode within VS, It gives me:
(From the Solution Explorer)

Script Documents
     Windows Internet Explorer
            carrzkiss

Of which the "carrzkiss" file is a :
The page cannot be found
File.

What do I need to do next?
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Hi, the "Script Documents" folder in the solution explorer while you are running the debugger is where you would be able to debug client-side code such as JavaScript and VBScript.  In this case, you can ignore those bits.

It is good that your debugger is working and you can step through your test.aspx page.

When you browse to /User/carrzkiss the first code that should run is the Application_BeginRequest event in the global.asax file.  Can you set a breakpoint on the first line of that procedure, and see if the breakpoint gets hit?  If it doesn't, what do you get in your browser?  If it is "the page cannot be found" then IIS is receiving your request but not passing it on to ASP.NET because it is looking for a physical folder with that name.  If that is the case, we need to do further configuration of IIS to get it to pass all requests to ASP.NET.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
OK. Here we go.

I place the break here
>>                      string url = Request.Url.ToString();

Now, F5
The page loads to:
/User/carrzkiss/test.aspx

I remove
/test.aspx
And hit [Enter] To load
/User/carrzkiss
And it stops at the breaking point.!!!!
This is good, it is firing, and the page stops loading while it is on the Breaking Point.
At the bottom in the [Immediate Window] I have the succeeded message.
When I click on the carrzkiss file within the [Solution Explorer] to see what it is.
And it is a The page cannot be found

Now, when I hit F5 again.
The page loads to the [The page cannot be found]

So, that is my steps and conclusion of the test.

========Within IIS==========
I have:
apsx: Check that file exists (Unchecked)
(That is defaulted when installing IIS5.1 on WinXP)
--------------
So, I am at a complete loss as to why you guys can get it to work on your WinXP system's
But I cannot get it to work on mine.

The good thing about the test that I did, was that it does stop at the [Breaking Point] that I set
When I load just the url of: User/carrzkiss
So, it is picking up on it, just not telling me nothing

--------
I had to step away for the morning, and just go back in a little while ago.
If not, I would have been here for your reply and we could have further investigated this issue this morning, and hopefully come to some sort of resolution with this issue.

Have a good one.
Carrzkiss
0
 
LVL 30

Expert Comment

by:Brad Howe
Comment Utility
Hi Carrkiss,

I know you don't like links but download this source demo project and test it out. It would fine in my demo platform.

ASP.NET 2.0 Demo using HTTPModule in VB.NET
                   http://nerdymusings.com/UserImages/URLRedirect.zip
The only change you need to do is setup your PageNotFound.aspx URL for 404 Errors.

Setting Up 404 Redirection in IIS
1. In IIS Manager,  Right click WebSite
2. Click the Properties
3. Click the Custom Errors tab.
4. Select the 404 HTTP Error and click the Edit Properties button.
5.Type - URL /PageNotFound.aspx
6. Save your changes.  
* NOTE
            You can remove most of the files. The key files are
                       web.config
                       App_Data\Redirection.xml
                       App_Code\URLRedirector.vb
                       PageNotFound.aspx (.vb)

All the others are just for demo purposes. Once those are inplace and the 404 is set, modify the Redirection.xml.
Now, the challenge is to query your DB for a profile ID and then redirect. This demo code does 80% of the setup for you. :)
                                         
Let me know if this works for you or if you want it customized. It will take some time for me to customize this code for you but I can do it when and if i have time.
Cheers, Hades666
 
0
 
LVL 12

Accepted Solution

by:
Hairbrush earned 500 total points
Comment Utility
In your IIS settings there are 3 things that need to be set in order to have all your requests routed to ASP.NET:
Filter-properties.PNG
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Please check this and the screen above are set, as I think this is the problem you have with your existing code.
Configuration.PNG
Extension-mapping.PNG
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Assuming you've not yet written profile.aspx then if your filter and association is set up properly in IIS then this is what you should see when you try to view a user page.
working.PNG
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Well Hairbrush.
I did everything you stated here and it works.
The downfall is that "My Hosting Provider WILL NOT" set this up for me.
So I am unable to use it.

Hades666
using the Error 404 page, this renders me helpless when it comes to any 404 errors that may appear.
Is there a way to check and see if:

if User then
' send information for the user
elseif OnError then
' send information about the error
end if

The reason for this, is what I am on a shared server, and I have 7 sites running under
Our account, and if I change the 404 error page for one, it changes it for all of them,
And that I cannot do.

Please let me know.
Thanks Hairbrush for the long awaited answer.
I have already tried my hosting provider for getting them to do something else for me,
And they plainly stated with with the IIS, they do not touch it, even though this only
Effects this one site.
I will try to send them another message and ask, but I doubt it.
I chewed out the last guy I talked to and threatened to leave them.
So, Unless I have a dedicated Server with this a**holes, there nothing I can do
Which defeates the purpose of paying them money, right?

Carrzkiss
0
 
LVL 30

Expert Comment

by:Brad Howe
Comment Utility
that demo support both. if the redirect is found the URL is provided.  If it is not found then you simply show the 404 error page.
-Hades666
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I will check it out.
Thank you, I have always been warned that if you mess with the 404 error page that it breaks the actual error.

Going to test it.
Carrzkiss
0
 
LVL 30

Expert Comment

by:Brad Howe
Comment Utility
Remember the the 404 error is jsut a file type point to a .asp page. This code, creates a URL to capture the 404, and redirect to the appropriate page/URL.
what you could do IF you wanted the standard 404 page is redirect to the default 404.asp page.
Just a thought,
Let us know if you need any help. And if so, could you provide a sample table that you are querie the profile ID from (Fields etc). When i have a moment, I'll see what i can cook up for you.
-Hades666
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
OK.
I am a little confused here.
The redirection.xml file.

I am going to be dealing with (right now a few, but in the future possibly up to a million users)
So. what do I need to do inside the redirection.xml file?
This file is not where the processing is done at is it?

If I can do it like this:

site.com/carrzkiss
Then this is the way I would LOVE to have it work.
If not, then
site.com/User/carrzkiss
will be fine as well.


------
What my questions is rather is:
do I have to list all the username in the redirection.xml file
Or if not,
what purpose would the file present to me in my case?

0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
table will be:

username = varchar(25)
mpsuid = INT

The url that needs to be redirected to is this.
Main.asp?Type=Profile&memid=1

Now, if I understand it correctly, you have to make some changes wihin IIS in order to redirect a .aspx to .asp
If that is the case, then I was thinking about doing this.

The initial redirect gets sent to
Main.aspx?Type=Profile&memid=1
And then the this aspx page does a redirect to
Main.asp?Type=Profile&memid=1

I guess that would be a good way to do it??

Carrzkiss
0
 
LVL 30

Expert Comment

by:Brad Howe
Comment Utility
Hi Carrzkiss,
The redirection.xml is similar to a httpd.ini file for ISAPI rewrite or a .htaccess file for apache. It is just a source destination mapping file.
do I have to list all the username in the redirection.xml file  Or if not, what purpose would the file present to me in my case?
> Exactly.... This file is for a Proof of concept. For your case, I would use the sample code and modify it to query a datatable source and return the proper path back to the page load.

Sample workflow
1. User requests  site.com/User/Username
2. IIS says, ($%%$#@$!) page doesn't exist.
3. IIS then loads the custom pageNotFound.aspx.
3. On Load, PageNotFound.aspx parse Request URL and querie Datatable for "Username"
     Results:
        A - "Username" is found and memid = 1. Then user gets redirected to site.com/Main.asp?Type=Profile&memid=1
        B - "Username" is not found. Then user gets redirected to site.com/404.asp which is the standard ASP 404 error page.
The only change to IIS is to flip the 404 error page from a FILE link to a URL path.
 This will require some development work on my side but it is possible.
Cheers, Hades666
 
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
I understand what you are saying now.
I am some what familiar with the .htaccess but not the httpd.ini
Either way.
I understand how it works now, thank you.
But, being new to asp.net, I have no idea where to start with this.
I will be waiting your reply.
Also.
If you would like.
I can close this thread out, and open a new one that is more dedicated to the 404 redirect.
As this thread is loaded to the gills.

I will accept hairbrush for his comment here http:#a33716753
As it works, just will not work for me
I will then post the link in here for the next question.

Thank you hades.
Carrzkiss
0
 
LVL 30

Author Closing Comment

by:Wayne Barron
Comment Utility
This works, just will not work for my hosting package, which sucks, but.
What can you do? (find another hosting provider or host in-house)

The future will tell.

Thank You
Carrzkiss
0
 
LVL 30

Expert Comment

by:Brad Howe
Comment Utility
Seems fair :) Good Job HairBrush. See you on the next one.
Carrzkiss, Does the sample work flow do what you need?
-Hades666
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Here is the question Hades666
http://www.experts-exchange.com/Q_26486665.html

Have a good one.
Carrzkiss
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
Yes, to the sample workflow
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
@hades666
Just wanted to check in with you to see if you were still going to help me out on this other thread?
http://www.experts-exchange.com/Q_26486665.html

Please reply to this post within the link above.
Thank you for your assistance.
As I really, really need this for me site as soon as possible.

Thank You
Carrzkiss
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
If you're keen to go live with the IIS5 approach and intercept the request in global.asax then you can change the

if (url.Contains("/User/"))

line of code to parse the request differently i.e. assume that the first whole word is the username and redirect based on that.
0
 
LVL 30

Author Comment

by:Wayne Barron
Comment Utility
IE9 does not want to work with EE...
I cannot type in this area with IE9, so I had to open Chrome.


OK.
I just ran the server script to check to see what my hosting server is and

                     Microsoft-IIS/6.0

So, it is pretty bad when the hosting provider does not even know what they have...
Pretty blasted sad.

now.

What exactly are you referring too?
Since I have no IIS access what-so-ever, I can only use what I can use that does not
Have me messing with IIS.

So, Hopefully IIS6 holds something else that we can use that is already there.

Have a good one.
Carrzkiss
0
 
LVL 12

Expert Comment

by:Hairbrush
Comment Utility
Ok I see what you're saying now - you can't make the config change in IIS6 to allow wildcarded requests to be passed to asp.net...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now