Skip navigation.

Run, Run As Fast As You CanAll recent postsVS.NET - Designer's "Best" Friend

What Is get_aspx_ver.aspx?

The other day I ran into a really weird problem. Upon opening a web project my custom error handler would fire me an email that a 404 (page not found) was encountered. It's strange because it happens right when Visual Studio.NET 2003 loads a web project. You don't even run the project, you only load it but a 404 is already thrown. Taken aback by this issue I did a quick search at the ASP.NET Forums and found two posts: see this thread and this one.

It turns out that Visual Studio.NET 2003 places a request for this non-existent get_aspx_ver.aspx page to determine the version of ASP.NET installed on your server. This version check by VS.NET 2003 is supposed to be "internal" but I guess it has public visibility now.

Visual Studio 2002 is void of this problem.

Being diligent about reporting exceptions I wired an HTTP module with a custom error handler along the lines of ASP.NET Custom Error Pages. After I enabled error handling in the <customErrors> element of my web.config VS.NET 2003 started tripping by error handler and emails would go out every time I'd load the project.

Strangely enough, I haven't found an agreeable solution to this bug. If you find yourself in a similar bind try one of these things:

  1. Set <customErrors ... mode="Off"> unless you have to have error handling enabled on your own box.
  2. Add logic to your error handler to ignore this page. This one is lame but it saves you frustration and it works.
  3. Somebody also suggested adding an empty page with the same name, get_aspx_ver.aspx, but I think this is going too far.

What bothers me now is that this weirdness occurs with one web project only. The rest of them are fine. I don't have .NET 1.0 installed as it was suggested a corresponding binding between VS.NET 2003 and 1.0 could be missing.

If anyone knows a better way to address this, please let me know.

Comments

Comment permalink 1 Panayot Belchev |
Here is what I do in global.asax:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError().GetBaseException();

if(ex.Message.IndexOf("get_aspx_ver.aspx") == -1)
{
string body =
"MESSAGE: " + ex.Message +
"\nSOURCE: " + ex.Source +
"\nFORM: " + Request.Form.ToString() +
"\nQUERYSTRING: " + Request.QueryString.ToString() +
"\nTARGETSITE: " + ex.TargetSite +
"\nSTACKTRACE: " + ex.StackTrace;

Mail.SendErrorMail("Application " + ex.Message, body);
}
}
Comment permalink 2 bryantb |
I have also seen this problem handled in Application_BeginRequest:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
string url = Request.ServerVariables["URL"].ToString();
if(url.ToLower().IndexOf("get_aspx_ver.aspx") >= 0)
Response.End();
}
Comment permalink 3 Joel P. |
My addition to our exception manager class (which is automatically called by global.asax to trap any unhandled exceptions and email them to us):

if(exception.GetBaseException().Message.IndexOf("get_aspx_ver.aspx") != -1)
// bail out
Comment permalink 4 Chris |
http://support.microsoft.com/default.aspx?scid=kb;en-us;825792
Comment permalink 5 Jeff |
I tried BryantB's post and it effectively traps the request preventing the error from occuring, it does however slow the opening of VS2003 and an error contacting web server is shown briefly in the status, but otherwise opens. Thank you for the tip
Comment permalink 6 Robert |
I don't really like MS's suggestion of creating a physical file. And none of the solutions here are very elegant either.

After some thinking and some research with Reflector, I discovered this technique:

Basically, I’m forcing the framework to generate the page that the KB article suggested that we create manually.

Simply add a new HttpHandler to the machine.config.

[httpHandlers]
    [add verb="*" path="get_aspx_ver.aspx" type="System.Web.HttpNotFoundHandler" /]
[/httpHandlers]

(i had to use square brackets b/c of the HTML stripping - even HTML escape codes wouldn't work)

It prevents an exception, so your error log doesn't get cluttered by these bogus 404s, and you don't have to hardcode any workarounds with IndexOf.
Comment permalink 7 Milan Negovan |
Robert, this is a pretty darn good workaround! We gotta figure out if Visual Studio.NET chokes on seeing a 404 instead of this page. It's an "internal" page it's looking for, after all.
Comment permalink 8 Fred |
Tried the entry into machine.config but no luck.

I've tried everything but no luck.

Bummer.
Comment permalink 9 dtabraha |
While I agree MS's suggestion to create the physical file is sort of lame, it does kill two birds with one stone.

The annoying popup error "Visual Studio .NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or services." goes away, and you don't get the error log (email or otherwise) when the 404 happens.

On the good side, since it requests that file, you can sort of keep tabs on who is accessing your project by mining your HTTP logs for that file.
Comment permalink 10 dtabraha |
Another thought, why not make lemons out of lemonade?

If MS is going to request a file that gives the .Net version, why not make one that actually does the job instead of a bogus static file that you'd have to update every time you update .Net, or a forced 404 error to get the version?

I created the page in my project, with this in the ASPX side:

[B]Version Information:[/B][BR]
Microsoft .NET Framework Version:[asp:Literal ID="wlitDNFVersion" Runat=server /];[BR]
ASP.NET Version:[asp:Literal ID="wlitASPVersion" Runat=server /];[BR]
Assembly:[asp:Literal ID="wlitAsmVersion" Runat=server /];[BR]

And this in the VB side:
Protected WithEvents wlitAsmVersion As Web.UI.WebControls.Literal
Protected WithEvents wlitASPVersion As Web.UI.WebControls.Literal
Protected WithEvents wlitDNFVersion As Web.UI.WebControls.Literal

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wlitAsmVersion.Text = System.Reflection.Assembly.GetExecutingAssembly.ToString
wlitASPVersion.Text = System.Environment.Version.ToString()
wlitDNFVersion.Text = System.Environment.Version.ToString()
End Sub

That way if you wanted to, you could check the page for your assembly version, or to determine what .Net version is running without having to cause a 404. This turns an annoying bug into a possibly useful feature.

I couldn't find any alternative version information in the System object for the ASP.Net version as opposed to the Framework version, but if you come accross that you could change the second literal control to display that.
Comment permalink 11 Mike Armenti |
Microsoft is aware of this error. It is dervied from modifying the customErrors section of the Web.config file.

Just reference this URL for the explanation. - http://support.microsoft.com/default.aspx?scid=kb;en-us;825792
Comment permalink 12 Brunhilde |
Here is my version of what Panayot is doing, but in VB, for those who want a solution in that syntax (before someone asks).

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
Dim message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
Dim body As String
Dim ex As Exception

ex = Server.GetLastError.GetBaseException

If ex.Message.IndexOf("get_aspx_ver.aspx") = -1 Then
body = "MESSAGE: " & ex.Message & vbCrLf & "SOURCE: " & ex.Source & vbCrLf & "ERROR: " & Server.GetLastError.ToString
message.To = "errors@email.com"
message.From = "exception@website.com"
message.Subject = "Critical Application Exception: " & Request.Path
message.BodyFormat = Mail.MailFormat.Text
message.Body = body
System.Web.Mail.SmtpMail.Send(message)
End If

End Sub

Sure the problem only occurs when loading the project and if you have a custom error page, but it's still annoying! I hate this problem...
Comment permalink 13 frank |
The reason why you see this problem is that your custom error for 404 is pointing to an extension that is not mapped to the asp.net isapi, say 404. VS.net 2003 examine the http header returned to determine if framework 1.1 is installed, if the custom error page is set to an extension not mapped to the asp.net isapi, the framework version is not returned.

To fix the problem, simply change the custom error for 404 in your web.config to a asp.net page.

Keep in mind that you have to change the copy on the web.config on the server, not on the machine that you are deploying from.

Hope this helps.
Comment permalink 14 Evgeni |
Just put this in your global.asax

protected void Application_BeginRequest(Object sender, EventArgs e)
{
string url = Request.ServerVariables["URL"].ToString();

if(url.IndexOf("get_aspx_ver.aspx") >= 0)
Response.End();
}
Comment permalink 15 Joe |
Makes sense to me that it would be more efficient to handle the case of get_aspx_ver.aspx in the Application_Error handler in the global.asax instead of the begin_request handler. Why waste processor time on a freak exception with every request to the server?
Comment permalink 16 Uday Deo |
Hi folks,
This is kind a going back to memory lane (though not very good memories :)

I have a Solution with 6 projects. The startup project is created in VB.NET. Out of the remaning 5, two projects are VB.NET and rest are C#.

I had all stuff working till last week but I screwed up something that I can't load the startup project. I can load the solution with all other projects.

I am getting the same error as your server not running asp.net v. 1.1 etc. I tried to add the aspx file but not working.

I would really appreciate if anyone of you can throw some light.

Thanks in advance,
Uday
Comment permalink 17 Muthu Kumar |
I was working well with asp.net web and win applications in VS 2003..Due to some internal errors in my system i installed vs 2003 again...after that I can work with windows application but when i opened a web project it is showing this error "Visual Studio.NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET web applications or services." I have registered with IIS through the command "aspnet_regiis -i".....But still cant open and run the project..IS there any solution to solve this problem please anybody .Net experts can u help me....Waiting for ur helping hands..

With regards,
Muthu kumar
Comment permalink 18 Milan Negovan |
Muthu, I'm afraid the question in not related to the subject of this post. Feel free to ask folks at the ASP.NET Forums though.
Comment permalink 19 gopi |
any solution for the problem i have registered in the command prompt still i get this error

visual studio dot net has detected that your webserver cannot be accessed in the version 1.1
Comment permalink 20 ks |
I am also havin the same issue of get_aspx_ver.aspx and i notice that my app.end fires. the event is saved in the application logs and it says global.asax changed. i wonder whats the solution to this.? any help will be appreciated
Comment permalink 21 Scott Schreckengaust |
Add this to web.config:









This is caused by Visual Studio .NET creating a file, then requesting it to test for 1.1 Framework. The problem is when anonymous requests are not permitted.

The above allows for the authorization of a specific file for anonymous connection...

This is from http://blogs.ipona.com/james/archive/2005/02/16/660.aspx
Comment permalink 22 Scott Schreckengaust |
above post lost the data...
see the URL for the data...

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):