-
global file
Hey guys, when you have a global.asxc file, and upload it to the web host. do you have to upload the web.config or anything else? I Just uploaded my global.ascx file, but it's not being called. I am wondering if there's something else that i need to do?
-
Re: global file
-
Re: global file
I've never tried that but I would assume even simply uploading an ASPX file (with some code in it) won't work unless you have the web.config.
-
Re: global file
Hey,
Most likely you are going to need the web.config file as well.
Normally when I am publishing, I let Visual Studio work out exactly which files are required, by publishing to a temporary folder on my file system, and then uploading to the website from there.
Gary
-
Re: global file
Nope, that's not it. Anything else that I should b looking into? This is crazy! I am hosting mysite on godaddy. It works on my dev. server.
-
Re: global file
Hey,
What code do you have in the global.asax file? What exactly are you trying to do?
Are you using a Web Site, or a Web Application? i.e. is it precompiled, or not. If not, are you also uploading the code behind file for the handler?
Did you use the technique that I mentioned of first publishing to a local folder, and then copying everything onto the server?
Gary
-
Re: global file
I think it's my code causing it. Here is my code, but it works on my server.
Code:
//
HttpApplication app = sender as HttpApplication;
if (!Request.Url.ToString().Contains(".")) //check here if the url contains dot or not
{
//getting the username
string sUser = System.IO.Path.GetFileNameWithoutExtension(Request.PhysicalPath);
app.Context.RewritePath("~/default.aspx?user=" + sUser);
}
-
Re: global file
Hey,
You haven't really told us what is going on though.
What event is the above happening in? What are you expecting to happen, and when?
Gary
-
Re: global file
Well that ties to my old post that we were talking about checking like myspace does http://myspace.com/username
That's what I am trying to do in that piece of Begin_Request in global.asax file.
-
Re: global file
Ah, ok, now I remember.
Did I not suggest using IsFile? Did you try that? Did it not work for you?
As to why it isn't working on the production server, I can only assume that either something that it requires hasn't been uploaded, in which case, I would expect an error? Or there is a difference in the way IIS is configured. Or, the requested url isn't actually meeting the requirements of your check.
Did you end up implementing logging in your application? Can you trace what is going on when it executes?
Gary
-
Re: global file
Yeah if I put a response.write ("testing..") outside of that IF statement and go straight to http://mywebsite.com then it prints that out; however, if I put http://mywebsite.com/username it says page not found !!!
-
Re: global file
Hey,
Well this would suggest that the redirect logic that you are using, is not working as you expect it.
I forgot to mention this to you before, but have you heard of this:
http://urlrewriter.net/
It does some of the "heavy" lifting for you.
Just a thought.
Gary
-
Re: global file
Yeah I have looked into that but it's too complicated. This is just my beta website phase1. I just found out that it's not working when I hosted in the IIS on my dev. machine, but it works when I run it through visual studio 2008........ *clueless* What could be filtered? Check out this http://forums.asp.net/p/1477375/3439262.aspx
I still don't know what is theissue.
-
Re: global file
Hey,
Yes, this is the technique that is implemented within the ASP.Net MVC Framework. I thought I mentioned this to you before?
You can find more details about it here:
http://blogs.msdn.com/mikeormond/arc...nt-of-mvc.aspx
Gary
-
Re: global file
No no what I am saying is about the OP's resolution. I am wondering if I have to do anything to the web.config as well? Just don't know how.
-
Re: global file
This is getting hard. I even not use the global.asax anymore and use the urlrewriter.net , it still doesn't work on the server, but works with visual studio 2008 debugging process.
-
Re: global file
Hey,
Is it possible that you can show all of the code that you are trying to to use? There must be something else going on here that isn't obvious from what you have described so far.
You know that the event is getting fired, since you could do a Response.Write. Can you do another one, outside of the If loop again, and write out the Request.Url?
What is it? Is it different from what you expect?
Also, just to confirm that my understanding of this:
Code:
if (!Request.Url.ToString().Contains("."))
meets yours, can you explain what you expect to pass this statement and what you don't?
Gary