Aspx page does not open the first time in new browser session - asp.net

I have an application running in IIS7 with Windows Server 2008R2. When I open a new browser page and call any ASPX page directly (eg. www.mysite.com/registration.aspx) I get redirected to the home page (index.html).
When I refresh the aspx page it renders properly. Also if I call any other aspx page after this first failed attempt they all open properly.
I don't get any error, the aspx page just gets redirected.
I've been struggling on this. Appreciate help.

Related

IIS Server files Updated, but it is not updated in web browser view source. Why?

I deployed the web application in asp.net, there's one file named default.aspx that contains one script(ex : alert('dfdf');).
I removed the script and deployed again. The deployed default.aspx file doesn't contain the script. But after I copied the default.aspx file in Inetpub/wwwroot and access the page through web browser and checked view source : the script is present.
But, in Inetpub/wwwroot/default.aspx doesn't contain any script. I refreshed and restarted my IIS server and my machine too.
May I know why this happen to me? Help me guys
Yes you have the page on browser cache.
If you use google chrome, open the browser tools, then keep the click on the reload button for 3 seconds and a menu opens to gives you some option, like "hard reload" means that it will load the page with out cache.
Other way is when you change some page press Shift + click on reload button this is usually force to reload the page even if its on cache.
All the shortcuts for diferent browsers:
https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache

Getting Page can't be displayed error after Response.Redirect on submit button click

I am getting a weird error on my asp.net web form page. I have a legacy page built up with full functionality. It has got several data controls on the page. After performing required operations when I click on submit button, internet explorer goes blank. It says page can't be displayed.
My code is old enough, so it actually works on few production sites. But recently I have deployed on a new production site. If I browse the same page using internal URL and perform same operation, it does not show any error message and everything works smoothly.
To give a background for the issue, when I click on submit button it calls web service on backend and comes back with web services result. Once it gets results back, it uses response.redirect() to same page (by creating url - Request.Url.AbsolutePath)with some additional parameters in querystring. If I refresh page then it shows same page correctly.
Page in IE -
Page in chrome -
Issue was not in code, but as I expected in production setup configuration. In production configuration a public URL something like www.test.com was redirected to www.test.com:7500. So when user was request website URL, it was being redirected to 7500 port on which application was hosted. It worked great until, response.redirect performed in asp.net code. When response.redirect performed in ASP.NET, in Request.Url.AbsolutePath server got URL as www.test.com:7500. So it tried to redirect it to 7500. But this redirection was set at public URL. When internally it tried to do the same it was not working.
I went with quick fix approach to fix this issue. I removed request redirection on public URL and set my site on port 80. This fixed my issue.
With out seeing the code it could be a number of things.
But as a guess I think that there maybe some url rewriting going on and then when the page posts back to its self it is not posting back to the rewritten page but to the underlining page.
You can try setting the form action to the rewritten page in the code behind.
form.action = "myrewrittenurl.com/path";
You can also try setting the form action to
<form action='#'
Which can work with some rewriters.

HTML Page is working but aspx page is not working on IIS

IIS aspx website is not running if i include any aspx page but html page is working well and there are 2 more another application which is also aspx page that running very well.
Please help
Are you getting an error message? Check the Application pool settings for the application that is not working and make sure they mirror those of the applications that are working.

how to remove default.aspx as default page from my application

I have changed Home.aspx to the default page but still when I run the app it is still going to default.aspx page. When I delete the default.aspx page and then I run it gives an exception that page not find (not 404 page not found). In some other page when I click on Grid row it should fire a grid row command but it calls default.aspx page first and then it fires the row command event. There is a connection between row command and default.aspx page, no response.redirect event from javascript but I don't know why it is calling DEFAULT.ASPX page.
Problem occurs only in IE
I have already set Home.aspx as default page but still it is searching for Default.aspx page at startup (Visual Studio).
If it is only problem in IE and works fine on other browsers, then consider clearing the cache of IE. Then do a hard refresh(CTRL+F5) of your web page.
Please recheck that you have mentioned the default document in web.config file.
If you are in hosting environment,then please select the default file from IIS setting for start pages from the control panel.
*If you have already tried right clicking the page and selecting Set as Startup Page , Did you checked in Visual studio site property pages, in start options list item there is "Start URL" and specific page properties. try changing these values ?
Did you checked if you are using built in asp.net URL routing or any other URL routing modules,handlers etc?
PS: if you are using web application project rather than web site project this setting is [yourapp]>properties>web>StartAction>StartURL
If you are using any javascript or jquery, please check that any default redirection (like ~/ or /) is there.

asp.net webpage defaultDocument button click not firing

I have developed an asp.net website in VS2010. The defaultDocument is set to default.aspx in the root directory, as I have dome many times before.
For reasons unknown an asp:button in default.aspx is not firing correctly when the url is typed in without the file extension.
For example, if I type the url www.mywebsite.com the default.aspx page will load as expected, however, the button will not fire (it does postback but doesn't fire the server click event).
If i type in the url www.mywebsite.com/default.aspx it works as expected.
The problem I'm having only occurs in a live environment (I cannot recreate the error on the localhost).
Any idea's?
Sorted this out last night. It turned out it was an HttpModule of the Telerik web controls I use, in the web.config.
RadCompression... (or something similar). It compresses and cleans up code after an ajax response.
I have no idea why it was affecting the defaultDocument only, but removing it solved my problem.

Resources