|
-
Oct 20th, 2009, 03:05 PM
#1
Thread Starter
Frenzied Member
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?
-
Oct 20th, 2009, 03:06 PM
#2
Thread Starter
Frenzied Member
-
Oct 20th, 2009, 03:25 PM
#3
Fanatic Member
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.
-
Oct 20th, 2009, 03:25 PM
#4
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
-
Oct 20th, 2009, 03:32 PM
#5
Thread Starter
Frenzied Member
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.
-
Oct 20th, 2009, 03:34 PM
#6
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
-
Oct 20th, 2009, 03:41 PM
#7
Thread Starter
Frenzied Member
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);
}
-
Oct 20th, 2009, 03:43 PM
#8
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
-
Oct 20th, 2009, 04:00 PM
#9
Thread Starter
Frenzied Member
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.
-
Oct 20th, 2009, 04:03 PM
#10
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
-
Oct 20th, 2009, 04:10 PM
#11
Thread Starter
Frenzied Member
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 !!!
-
Oct 20th, 2009, 04:21 PM
#12
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
-
Oct 20th, 2009, 04:24 PM
#13
Thread Starter
Frenzied Member
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.
-
Oct 20th, 2009, 04:31 PM
#14
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
-
Oct 20th, 2009, 04:32 PM
#15
Thread Starter
Frenzied Member
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.
-
Oct 20th, 2009, 09:47 PM
#16
Thread Starter
Frenzied Member
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.
-
Oct 21st, 2009, 01:16 AM
#17
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|