How to allow user to enter email in QueryString in MVC4? - asp.net-mvc

User will type www.abc.com/Email/abc#abc.com
above code not work, It generates the error,
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Most likely causes:
The directory or file specified does not exist on the Web server.
The URL contains a typographical error.
A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
Create the content on the Web server.
Review the browser URL.
Check the failed request tracing log and see which module is calling SetStatus. For more information, click here.

Please read more here http://perishablepress.com/stop-using-unsafe-characters-in-urls/http://perishablepress.com/stop-using-unsafe-characters-in-urls/.
You should encode # to '%40' and decode it back to # in your MVC action.
To decode you can use encodeURIComponent
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_encodeuricomponent
you can use UrlDecode on backed http://msdn.microsoft.com/en-us/library/6196h3wt.aspx

Related

FineUploader Status 406 ASP.NET

I'm using fineuploader in a ASP.NET Web Application in order to upload files. The uploads are working in most cases. The problem is that the upload of a few files is not working, I'm getting status code 406 when the client sends the post request with the file's chunck.
I tried sending files with the same name,similar size and extension as the files that are not working and they worked so it doesnt seem to be an issue with the filename,size or extension.I couldn't find something in common between these files.
I configured the chunck size for 5MB but also tried chaging to 2 MB and 10MB but they also didn't work.
Here is print of the request, can someone identify the problem and how to solve it?
From the requests, it seems to be some problem with the cloudfront or IIS? I don't know much about this.
Edit:
Looking at the IIS logs I found this, it seems the user is '-' for the request that returned 406, is the cs-username '-' because of the 406 or is the request 406 because of the cs-username '-'? If it's the second, what could make the user be lost like this?
The error message 406 means either the mime type in your Accept request header is invalid for IIS or IIS server can't return data via the type in Accept header.
So please check whether IIS->World wide web services->Static Content has been installed. Please ensure the type in Accept header is also valid in IIS manager->site node->Mime Types.
Now that your client only accept application/json, please ensure your your code will return the correct reponse type.
If that's not working, please enable failed request tracing and post detail error messages in the FRT log.
https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshoot-with-failed-request-tracing

Kentico MVC - PageBuilder Error on external Staging site

Am using Kentico MVC v12 Service Pack.
Have enabled Preview feature and PageBuilder in Application_Start.
When running from localhost, can successfully edit relevant pages using PageBuilder as required.
However, when ran from a staging site, which is a clone of the localhost version, I am getting an error in the Site settings when I try to add a Presentation Url (I am definitely adding in a valid format with the starting "https://" included), which is required for the PageBuilder to be used in the Pages application, where I see this error:
An unexpected error occurred, see event log for more details. Event source: PageEdit, Event code PreviewLinkGeneration
Any assistance would be much appreciated.
Thanks.
Sites error
That error is basically only looking at the string of the URL (almost like a simple validation). Are you sure there is no whitespace before the value you entered in? I can re-create your issue if I type in a space character before the URL.
You can also try clearing the field and saving the form. Then re-enter a value.
If it is still not working, try re-signing all your macros in the system as I have seen the regular expression validation rules have issues if macros aren't working. Which is really what this check is:

Server Error 404 is returned when trying to get an authorization code from live.com

We have two applications which use OAuth2 authentication to get access to Hotmail.
The first application works fine. But in the second application we have an error after entering login/password:
Server Error
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
URLs and code used to show these URLs are identical in both application:
url = "https://login.live.com/oauth20_authorize.srf?response_type=code&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&scope=wl.imap+wl.offline_access+wl.emails&client_id=REAL-CLIENT-ID"
self.browser.load(QUrl(url))
Unfortunately, I have no idea how can fix it. Can anyone help me with this?
It's weird but this issue was fixed by adding:
QCoreApplication.setOrganizationName("anOrganizationName")
QCoreApplication.setOrganizationDomain("anOrganizationDomain")
QCoreApplication.setApplicationName("anApplicationName")
Perhaps it would be enough one of these string to fix issue. I didn't check it.

Access denied error message when trying to create a shared link to a folder in Box

So following on from my previous question around permissions to add collaborators, I am now having further permissions issues when trying to create a shared link to a folder in Box using the API.
So to confirm, I have the "Manage an enterprise" scope now enabled on the API account.
Here is the error message I am getting back:
{"type":"error","status":403,"code":"access_denied_insufficient_permissions","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Access denied - insufficient permission","request_id":"2137493926531843e3c61af"}
Here is the POST data I am sending:
{"shared_link":{"access":"collaborators"}}
Here is the URL that I am sending it to:
https://api.box.com/2.0/folders/1561835651
The folder Id is for a folder I have created using the API, and I am also able to add collaborators to that folder OK, so up until this point, I have all the correct permissions to perform these operations.
So my question is, what else should I be doing? I cannot see any more options against the account to suggest I need more permissions, and the documentation is not clear on what else I need to do to be able to perform this operation.
For CreateSharedLink method, the HTTP action is PUT. If use POST method, it will return 403 sharedlink access_denied_insufficient_permissions error.
-Ivy

Edit Web Part - HTTP 403 Forbidden Error

I have a webpart in a SharePoint 2007 site. This web part is written in object Model code. I am given Full Control to this Site Collection and can access the page with no issue.
When I tried to Edit it by clicking 'Site Actions--> Edit Page', I got the following error
Error:
The website declined to show this webpage- HTTP 403
Most likely causes:
•This website requires you to log in.
What you can try:
Go back to the previous page.
**More information**
This error (HTTP 403 Forbidden) means that Internet Explorer was able to connect to the website, but it does not have permission to view the webpage.
For more information about HTTP errors, see Help.
is that a user control or something like that which is accessing the File System path ?
if yes then you have to use SPSecurity.RunWithElevatedPrivilages(delegate() {}).
Have a look at this
Thanks
I resolved the HTTP 403 Forbidden issue. The root cause of the issue is, in my code has access to the file system on the server,to which the logged in users do not have the access while Editing the web part.
I have used RunWithElevatedPrivileges but only for getting the site info and updating the list. The code reading the config file and logging into the log file does not covered under ElevatedPrivileges.
I included them with Elevated Privileges, the users are able to Edit the web pat. We can also resolve this issue by giving ther read, write permissions to that particular files to 'SERVER\USERS'

Resources