Default Document In Web Form Does Not Work After Using MapPageRoute?
Jun 4, 2010
I have two strange problems when I use routing in a web form application. Environment: IIS 7.5; .NET 4.0 and Windows 7 64 bit.
default document does not work if I use (http://www.)mydomain.com. The exception message is "The controller for path '/' was not found or does not implement IController". However, if I debug in VS 2010 (http://localhost:8080), this problem has never come out. Here mydomain.com and http://localhost:8080 hit the same code in the same folder of the same computer. I trapped the value of request.path. When local host is used, the value is "default.aspx" while "/" if mydomain.com is accessed. I can use one line (if "/" then redirect to default.aspx) to "fix" the problem but I believe it should have a better way. when I detect request.path, I got such a VERY strange request which I have never seen before: 192.168.1.11/StableWSDiscoveryEndpoint/schemas-xmlsoap-org_ws_2005_04_discovery! I have no idea where it is from. I do not use any web service in my code. The request is posted to the server, and the user agent is WSDAPI. I tried to debug the code from a different browsers other than IE. It looks like I do not get such a request. Edit: I just found the 192.168.1.11/StableWSDiscoveryEndpoint/schemas-xmlsoap-org_ws_2005_04_discovery request is sent from the domain control.
I am trying to secure very mixed content that is located in an ASP.NET directory. For purposes of this question, it can be ~/MyApp/.
I want all of the content in the directory and its subdirectories restricted to authenticated users. The default.aspx page, though, should be accessible to everyone. This is the web.config in that directory:
[Code]....
Now if you are an unauthenticated user, everything works fine if you request [code]....
The problem occurs in that visitors do not always request "Default.aspx". We have a default document configured so that they get Default.aspx even if they just request "/MyApp". An authenticated user works fine, but an unauthenticated user is directed to the login page.
Now I know that essentially this happens because even though the request for "/MyApp/" will actually end up serving up "/MyApp/Default.aspx", the security system is only checking for "/MyApp/" since that is what I requested. That is then getting the default security for the directory.
How can you configure an exception to allow access when no particular file is requested in the directory??
Is there some dependency between DefaultDocumentModule and UrlAuthorizationModule? In this environment, the UrlAuthorizationModule has been removed and re-added in order to make sure it fires for non-managed requests. I would not expect that to change the order of execution, though, since UrlAuthorizationModule usually goes after DefaultDocument.
A workaround could be to set up the opposite security with the directory being open, and then trying to secure individual files. Because of the (changing) number of files, and extensions, etc, and the fact that you cannot use wildcards in a <location>, this is not really a workable solution for me.
How can i set different default document for each folder in my asp.net project.I have set a default document from IIS, but that doesn't show up for every folder browsed.I have already added HTMLs to the collection but they are not showing up, instead stander ed Forbidden error page shows up.
I've got an Asp.net site set up on GoDaddy which is using UrlRewriter.net (not to be confused with UrlRewriting.net) to enable url rewriting which seems to be working ok, though I had to set IIS to run in IIS6 mode, rather than IIS7. The problem I have is that my default document is 'virtual' so while it's possible to browse to mydomain.com/default.aspx just going to mydomain.com/ doesn't work - I presume this is because IIS is expecting default.aspx to actually exist within the root directory of the website. Is there any way around this problem?EditAs requested, here is the rewrite rule from my web.config file.
IIS6, ASP.NET 2.0, No Forms Authentication I'm calling Response.Redirect("~/foo.aspx"), but the default document ("Default.aspx") for my site is appearing. To make matters worse, it only happens intermittently. Sometimes the redirect displays the right page.
I've checked session state, and I don't see any values in the web.config (that is, I'm assuming I'm using the 20-minute defaults).
There's foo.aspx and foo2.aspx (and the default document, Default.aspx). All pages extend from BasePage, which extends Page.
BasePage has a property named ReturnPage:
protected string ReturnPage { get { if (Session["ReturnPage"] == null) { Session["ReturnPage"] = ""; } return Session["ReturnPage"].ToString(); } set { Session["ReturnPage"] = value; } }
Users click on a LinkButton on foo.aspx, and the click event handler ends with two lines of code:
The Page_Load of foo2.aspx has problems, and its error handling calls Response.Redirect(ReturnPage).
When I view the response headers of foo2.aspx, the 302 location is string.Empty (that is, there isn't one). That same response header has the same ASP.NET Session ID as the response of foo.aspx.
And remember -- this is intermittent. Sometimes, you can click on that LinkButton and go effortlessly to foo2.aspx, no problem. You can process the click with the exact same data once, and it will fail. You'll navigate from the default document (Default.aspx, where you were sent by the "bug") back to foo.aspx, click again with the same data (the same row in the grid/table -- the same LinkButton, essentially), and you'll be redirected to foo2.aspx without issue.
Is there a way to programmatically know when someone is using the Default Document feature of IIS to access my page (that is, the name of my .ASPX isn't in their URL anywhere)?
My login.aspx is in a Login folder of my website. I want this to be the default document of my website in IIS. is this possible? or should I create a home.aspx page that redirects to login.aspx?
I have an ASP.NET web site project, which I'm publishing to IIS on my Win2k8 R2 server. It has a default page called login.aspx. I set that up on the published web site.
Trouble is, every time I publish a new version of the web site, the login.aspx entry gets erased from the "Default Document" settings of the web site in IIS. This is very annoying. How can I publish my web site from Visual Studio without wiping out the default page every time?
I basically have quite a large site collection with various site and sub sites that all contain their own document libraries. I need to change the default view of each document library to include the following fields:
Checked out to.
Check in comments.
This is ok as I have written an app that will loop through all existing lists and do this however is there a way I can change the template for a document library so that any future lists that are created will automatically contain these two fields in the their default view?
I have spent a day and a half trying to resolve this issue. Bascially have an ASP.net website with Forms Authentication on IIS7 using Framework 4.0.
The Authorization stuff seems to be working perfectly for every scenario with the exception of hitting it with no document specifed (Should resolve to Default Doc).
For example [URL] works perfectly, this page should allow anon access as specified in the web.config.
but if I hit [URL] Directly it redirects to the login page with Return URL set to "/" or Login.aspx?ReturnUrl=%2f
Some things I have tried:
1) Set Authentication to None and then the Default document worked so thats not the issue.
2) Added DefaultDocument attribute to Web.config
3) Deleted all entries for in Default Document list in IIS except for Default.aspx
4) Added MachineKey entry in Config
5) Toggled from Integrated to Classic pipeline in IIS
I have an ASP.NET website application, and there is a home page for my web site. I need to be able to change the default document of my website programmatically (C#) so that I can make another web page take priority above the one that already exists. I would then like to revert back to the previous default document order.
Example :
I have two home pages - Home1.aspx and Home2.aspx. In the IIS default document settings I have added the two pages and made Home1.aspx be the first default document then Home2.aspx the second. I need in some cases to be able to change the order of the two default documents so that Home2.aspx is the first default document then Home1.aspx the second.
I have one asp application. When i deploy this application in iis like www.xxxx.com , my index page is in the sub folder like root/home/index.asp , so when i set this as default document , browser will redirect to this url. But without redirection is this possible to load the default document in www.xxxx.com
I need my default document while browsing www.xxxx.com without redirecting to www.xxxx.com/home/index.asp
The problem is that i can't establish a Default Document to an non phyisical file. I want that the Default Page be : Home.aspx (which is a non phyisical file).
So when I go: [URL] I get an error: HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
I do not want to make a REDIRECT.
Is there any way to accomplish this without having to create a index.html to redirect to Home.aspx?
if there is a way to determine if the default document has been served using .net? I thought perhaps something would be available in the server variables, but I can't seem to find anything that distinguishes between [URL] and [URL]
I created the simplest MVC project with Visual Studio 10, and it works fine on the VS Development Server, but won't run using IIS on the same computer under IIS (Windows Server 2008 R2 with ASP.NET 4.0.30319).
My steps were:
File / New / Project ...Visual C# / Web / ASP.NET MVC 2 Web Application... and kept the default name: MvcApplication1
Clicked Debug to build and run ... the default page appears fine at http://localhost:49175 ...
Then I closed that browser and clicked on MvcApplication1 / Properties / Web and selected "Use Local IIS Web server"Clicked "Create" to create the virtual directory at http://localhost/MvcApplication1
Clicked Debug again... and got HTTP Error 403.14 (Web Server configured to not list directory)
It seems that IIS cannot find a Default document. If I add a document to the virtual directory (C:inetpubwwwrootMvcApplication1) with one of the default doc names, that document will display OK.
Why can ASP.NET find the default document (Views/Home/Index.aspx) when running from the VS Development Server, but not when running from IIS??
I have tried running "aspnet_regiis -i", but still find that C:inetpubwwwrootaspnet_clientsystem_web4_0_30319 is an empty folder. Should there be something here?I have tried giving all sorts of permissions to the virtual directory folder (C:inetpubwwwrootMvcApplication1) but without any success.
I want to know if there is a way to set up the default document or default web page from the setup project of a web page.What I mean is that I would like my web app installer to set the default page (i.e: DefaultPage.aspx) when installing the web application. I remember I could do this in previous versions of the asp.net platform, currently I am working in ASP.NET 3.5 (Visual Studio 2008).
I have to have a web form that allows the user to print a PDF Document from a web form or web service. The requirements are that the user will not see the pdf before printing, the call to print will actually happen on the Web Server it's self, the web server does not have adobe, and the document has to print to a Network printer that the web server is not setup to print to.
I'm having a strange issue with MVC 2.0 that I can't find any information about.
Basically, I'm adding ASP.NET 4.0 WebForms URL routing for legacy pages on an application that also has MVC pages. Once I add *any* routes.MapPageRoute to Global.asax.cs, all of my MVC ActionLinks/etc immediately break and all point to the first "MapPageRoute" that was registered.
If I comment out the first MapPageRoute line, then all of my MVC links suddenly direct to the next MapPageRoute I have defined.
what's wrong? I checked my route names and none are duplicate, and none of the routes I am adding conflict in any way to my MVC routes. It seems as though I might have some sort of web.config configuration issue?
I am attempting to use the MapPageRoute feature in Visual Studio 2010 and .NET Framework 4.0 with a asp.net webforms application.
What I have noticed is that if I define a page route called "Default" like below and the page Default.aspx exists in the project, then the route does not work.
If I change the name of the Default.aspx in the project to Default_1.aspx, then the route works fine.
There seems to be some order of precedence going on. Is there a way to make my route definitions evaluated first so I don't have to rename my pages to use the routing engine?
The pages on my project are base on master and content pages...
I want to do something with javascript(rather than jquery) in one of content pages after ALL OF MASTER AND CONTENT ELEMENTS ARE LOADED COMPLETELY.(for example set focus on a RadComboBox Control)
But alert(combo); always returns null.(the $find code is for telerik controls and the upper codes about telerik controls are completely true)To solve this null problem I test the ways shown below:
1-I Removed all of controls from master and content page except RadComboBox Control and null problem disappeared , so i derived the null peoblem is about all of elements of master and content page have not been loaded when
$find("<%= RadcbPersonelCompleteNameInvwNoskhehEdit.ClientID %>"); is fired.
2-so i used $(document).ready(function() { my codes }); instead of onload = onloadOfDocument;
3-at last i test the below code and it works perfectly : <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <script src="../JQuery/jquery-1.4.1.js" language="javascript" type="text/javascript"></script> [code]...
What function of document should i use for doing some javascript codes after all Of MASTER AND CONTENT ELEMENTS are loaded completely?
I am hiding a TextBoxin my aspx page like this: myField.visible=false; Now I have a DropDown as well which tries to access the TextBox on IndexChange. The problem is, it cant access the hiffen TextBox and I am getting document.form[0] is Null or Not an Object. How can I solve that? Is the some check for that in JavaScript?
In my asp.net 3.5 web site i have default.html page defined as first default document in iis 6 web site configuration window. I have URL rewriting module written and when the request for default.htm comes its pointed to default.aspx page.
On pressing enter key, I want and image button's click event to get fired. So i have placed the textbox and button inside a panel and given the image button's id in 'DefaultButton' property of the panel. But on pressing enter key, the image button's click event does not get fired. The code is pasted below:
[code]....
Also provide code for search textbox function present in stack overflow website. On entering text in textbox and pressing enter key, the search function should get executed.