I am creating a windows web app on visual studio. When launched, I need the web browser to start up with the login page but it doesnt, it starts up on a different page. Anyone know why? or how to remedy the problem?
Henks answer looks like what you want, but if you are using ASP.NET MVC? you could tag your controllers/methods with the [Authorize] attribute. This would redirect users that is not logged in to the login page (or any other page should you decide to override the defaults).
Go to your project's properties page (right-click on project, select properties).
Go to the "Web" tab
Change the "Start Action" to your login page.
I'm guessing that at the moment your setting is to open the current page.
You could modify your web.config file, in this way you could indicate the default page, something like this:
<system.webServer>
<defaultDocument>
<files>
<remove value="default.aspx"/>
<remove value="index.html"/>
<remove value="index.htm"/>
<add value="Login.aspx"/>
</files>
</defaultDocument>
</system.webServer>
Related
During the Pen Test, we received one vulnerability. Repro Steps was Change Host (let's say google.com) to different domain and then hit URL. Then following screen shown,
Here Version Information for dot net framework is showing. I weant through various atricals on internet and they are asking to used in web.config
This tag is already present in web.config and when we hit url without chaning Host it is showing error.aspx page but when we change Host it is showing attached page.In attached image Version Information is mentioned and I want to get rid of that.
Also on out testing envrionment,the version information is not shown with resource not found message. Is there any way to remove version information apart from customErrors tag. Please help me out. We are using IIS 10.
The tag you are already using in the web.config is probably the <customErrors> tag. and that's great for errors that can be caught at the .Net level.
But for errors that don't enter the .Net pipeline you will need to configure the IIS error page for the 404 error. This can be done via the <system.webServer><httpErrors> section of the web.config. For example to return the contents of my-iis-404-page.htm which you locate in the root directory of the website, you could use this:
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Auto">
<error statusCode="404" subStatusCode="" prefixLanguageFilePath="" path="my-iis-404-page.htm" responseMode="File" />
</httpErrors>
</system.webServer>
This configuration can also be done via the IIS gui. For more information about httpErrors aspect of IIS see https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/
If you want to remove the X-Aspnet-Version HTTP header from each response from ASP.NET, add the following code to the web.config file.
<system.web>
<httpRuntime enableVersionHeader="false" />
</system.web>
I have the strangest error. I am uploading my .NET 4.0 application on a new server and want to set the default document in the web.config file using the code below.
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear />
<add value="http://domain/folder/home.aspx" />
</files>
</defaultDocument>
<system.webServer>
The problem is when the page is loaded it goes to http://domain/folder/home.aspx/ with a last lash added which causes the header and menu not to load. If I delete the last lash after the URL everything loads fine.
My question is how to I set the default page without the last lash adding to the URL.
I tried setting the default document from the control panel on my server but it will not allow me to route to a sub folder
In my project Index.aspx page is set as a default document.
I tried to debug is not firing the button click event on localhost:1992,but it is working perfectly on localhost:1992/Index.aspx.
ISSUE : project working in localhost:1992/Index.aspx not working localhost:1992
Kindly give the solution for this issue?
UPDATE
I've set Index.aspx page as the startup page
NOTE : Client side click is working. only server side click is the problem here.
Because you haven't specified a page as a startup page.
Right click on the page you want to be the start page and then click on the set as a start up page option.
You can do this by editing web.config file,
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.aspx"/>
</files>
</defaultDocument>
</system.webServer>
Use clear tag before add tag
I published an Asp.Net web app on Azure website from Visual Studio and I can't manage setting a default page.
I have added this to web.config
<defaultDocument>
<files>
<clear />
<add value="Default.aspx" />
</files>
</defaultDocument>
I left only the "Default.aspx" on Azure control panel in Default Documents.
But when typing a hostname in address bar, I still get "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable".
How can I do it properly?
Thanks
When creating a website on azure I've chosen Asp.net Emply Website and the Default page (of my own) simply doesn't work there. Then I have created by an option of 'Quick Create' and it works great.
Go to App_Start\RouteConfig.cs and edit the rule properly. Or just delete them.
I have a custom config file in my application say my.config. Suddenly I ecnountered with some error regarding one of the settings inside the config file and the strange thing happens- my content of the config file get's rendered in the browser in the form of error. This is a big security issue for me. My question is how to prevent the content of my config files from rendering in the browser. Note I have already this setting in my web config:
<customErrors mode="Off" defaultRedirect="errors/default.aspx"/>
I am wondering why did not it redirect to error page? we had the settings turned on
still it displayed the straight error.
Are you running IIS7? I think you have to add a section to the new system.webServer section of your web.config file to change the behavior of the custom error page. Open IIS and check the settings for the error page setting.
In web.config it should be something like this,
<configuration>
<system.webServer>
<httpErrors errorMode="DetailedLocalOnly">
</httpErrors>
</system.webServer>
</configuration>
/Viktor
set the customErrors mode="On".