Autogenerated Id in RavenDB - c#

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

Related

Error with versioning with attribute routing in ASP.NET WebAPI 2

Found one example on the whole Internet of the following, and it was on StackOverflow, but there was no follow up whether it had been solved or not. This error happened after I implemented accept header versioning with attribute routing in a WebAPI 2 project.
Message: "An error has occurred." ExceptionMessage: "The given key was
not present in the dictionary." ExceptionType:
"System.Collections.Generic.KeyNotFoundException"
found here on stackoverflow:
How to get controller name when Web API versioning with routing attribues
I am not sure how you implemented this as you have not shared any code, but you can take a look at the following sample demonstrating Web API's attribute routing and versioning through route constraints.
http://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/RoutingConstraintsSample/ReadMe.txt
The above sample looks for a custom header called api-version, but you can easily modify this to suit your scenario.

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.

Browser Error when i run MVC3 application

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.

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

Url rewriter in ASP.NET: Resource cannot be found

I am using the url rewriter described here.
On production, it works great but locally, for any links that uses url rewrite, it says:
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.
Do you have any idea why?
Do I have to install IIS locally and configure something?
Some rules I use:
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>/Payment/Secure/Order.htm</LookFor>
<SendTo>/Payment/Secure/Order.htm</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>/Payment/Secure/Result.htm</LookFor>
<SendTo>/Payment/Secure/Result.htm</SendTo>
</RewriterRule>
<RewriterRule>
..
They are all defined well because they work in production...
Thanks a lot!
Locally, Url rewrite only works with IIS running on localhost for your website!
Yes specify the correct path name for your web server.

Categories