Browser Error when i run MVC3 application - c#

I am getting an error on my browser when i try to edit or delete it says:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /console/Delete/PS3
But the strange thing is when i put my mouse cursor into the browser address bar and press enter the delete and edit page appears
Can you please help me with this. If you need any information regarding this just let me know and i will provide.

Check if you have added routing for "/".
In most cases it is because of omitted routes.

I guess it is because the related actions has [Get] attribute defined on them, so add [Post] attribute should solve the problem.

Related

Autogenerated Id in RavenDB

Please I am using the default ID Generation in raven DB inserting and everything seems to work fine for now
However My ID Has the following format "entityName/1"
so if added as a route value, the following URL Results
http://localhost:10563/Settings/Edit/SystemSettings/1
Which as u can guess results in the following message
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Settings/Edit/SystemSettings/1
Please how can I change this behavior
Thanks in advance
There are multiple ways of solving this conflict between MVC routing and RavenDB's naming conventions, the easiest way is described here (bottom of page): http://ravendb.net/kb/3/using-ravendb-in-an-asp-net-mvc-website

Browser shows Server Error in '/' Application MVC4

Currently I am Working with MVC4.I have doubt, I tried to debug when index.cshtml is open ,
It shows Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Views/Report/Index.cshtml
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929.
When I debug with other pages than index.cshtml, it works fine.Why it happens? Can you please give resolution?
I think you are requesting wrong URL: /Views/Report/Index.cshtml
It should be hostname/Report/Index i.e. http://localhost/Report/Index
You are calling it wrong way..
Your request pattern should be as follows:
ControllerName/ActionName
Therefore your request sholud be http://localhost/Report/Index
The process is as follows:
When you will hit http://localhost/Report/Index
your request will get redirected to Index Action located in ReportController.cs
Then the Index Action will return the Index.cshtml view located in "Views/Report" folder.

View as start page

I don't know about ASP.Net at all, I right click on the file Index.cshtml in views and accidentally choose "Set As Start Page"
Now when I run the application (Ctrl+F5), the error occurs
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Views/Home/Index.cshtml
You can change the settings in the Project properties, this other stack article should help: Visual Studio ASP.Net MVC undo set as start page action

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed,

I was told to work on the google api.
its pretty much the same as FB but I am having a slight trouble with redirect_url
This is the url which my app is using to get a access token
https://accounts.google.com/o/oauth2/auth?client_id=**********3-uiqulutgsobu5df302tup49v6e6ae5qu.apps.googleusercontent.com?&redirect_uri=http://localhost/Default1.aspx&scope=https://www.google.com/m8/feeds/&response_type=token
When I registered the app
I set the redirect_url to
http://localhost/Default1.aspx
In my project there is a page called Default.aspx. The name of the solution is Googleprofiles.
It gives me an error:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could
have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Default1.aspx
Looks very simple. But I am unable to fix it..
Need some expert help
Thanks
Sun
Your redirect_uri is wrong, change it or rename your Default.aspx to Default1.aspx:
redirect_uri=http://localhost/Default.aspx

How can I resolve this custom error redirect in ASP.NET

I want to redirect all url errors
The url I want to cath is ~/bla/foo
It should redirect to ~/error404.aspx
bla exists as a folder. foo does not exist.
I already set the webconfig to point to my error but I just doesn't work. I get this error:
Server Error in application /.
-------------------------------------------------- ------------------------------
The source can not be found.
Description: HTTP 404. Perhaps you are looking for the source (or a dependency thereof) removed or is temporarily unavailable or has changed its name. Check the spelling of the URL.
Requested URL: / bla/foo.asox
I google translate this error cuz VS here is language specific.
What can I do to resolve this??? I want to point to ~/error404.aspx
You can also configure a custom 404 page in IIS (this example is IIS 6). That way request for any resource that doesn't exist will go to your custom error404.aspx page.
There's also a walk through here with screen shots here if that helps. This would be something you configure outside of your application.
If you want to change the 404 message to a custom one, here are the steps to override the default one:
You can use:
protected void Application_Error(object sender, EventArgs e)
{
}
http://aspnetresources.com/articles/CustomErrorPages.aspx
There are more details in the link which show you exactly how to catch the 404 error and handle it.

Categories