I am trying to follow a tutorial on creating a log in system and adding users in asp.net and i cant seem to work out how to use the apparently outdfated or expired Web Site Administration Tool. is there a new equivalent tool i can use or is there some way to get it to work as i cant seem to get it working using the command prompt.
I have tried entering this into the command prompt which works fine in order to rune iisexpress:
"C:\Program Files\IIS Express\iisexpress.exe" /path:c:\windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/asp.netwebadminfiles" /port:8089 /clr:4.0 /ntlm
I then enter the following into my browser:
http://localhost:8089/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=[Exact_Project_Path]\&applicationUrl=/
Where the project path is set to my project path but get the following error:
System.ArgumentException: The parameter 'PhysicalDirectory' is invalid. Parameter name: PhysicalDirectory at System.Web.Configuration.VirtualDirectoryMapping.set_PhysicalDirectory(String value) at System.Web.Configuration.VirtualDirectoryMapping..ctor(String physicalDirectory, Boolean isAppRoot) at System.Web.Administration.WebAdminPage.OpenWebConfiguration(String path, String appPhysPath, Boolean getWebConfigForSubDir) at System.Web.Administration.WebAdminPage.VerifyAppValid()
This to me seems to be that the path i enter is invalid but i have tried every different entry surrouding my solution.
Is there a new or better answer to creating a log in system with asp without all this fuss?
Very new to all this so please take it easy.
Take a look through https://www.asp.net/identity, and in particular the Introduction to ASP.NET Identity post, which gives an overview of the older ASP.NET Membership and the newer ASP.NET Identity. Identity is supposed to be a lot easier to integrate into your app.
Related
We have a Xamarin.Forms application that I am trying to upgrade to MSAL (has been using ADAL up until now) in order to authenticate users that exist in our Azure Active Directory. The app uses the Prism framework. It seems I am able to use MSAL and authenticate using the app on Android, but when trying to log in on the UWP version, I get an error stating that msedge cannot be opened:
msedge.exe error "Windows cannot access the specified device, path or file."
This occurs when AcquireTokenInteractive is called on the PublicClientApp.
public Task<IAuthMSAL> AcquireTokenInteractiveAsync(string[] scopes)
{
var options = new SystemWebViewOptions() { OpenBrowserAsync = SystemWebViewOptions.OpenWithChromeEdgeBrowserAsync };
return PublicClientApp.AcquireTokenInteractive(scopes)
.WithParentActivityOrWindow(ParentWindow)
.WithUseEmbeddedWebView(false)
.WithSystemWebViewOptions(options)
.ExecuteAsync()
.ConvertToProvider();
}
For reference, the PCA is being built just as I've seen it be built in a lot of documentation that I've read:
AuthenticationService.PublicClientApp = PublicClientApplicationBuilder
.Create(config.ClientId)
.WithAuthority(config.Authority)
.WithDefaultRedirectUri()
.WithBroker()
.Build();
Since the error message alludes toward a permission issue or missing executable file, I've ensured that msedge.exe is available in the location shown in the title of the error, and edited the security on the msedege.exe allowing full control on all principals listed (right clicking the executable, selecting properties, security tab) to see if that would help, but it did not.
I've also tried various extension methods on the PublicClientApplicationBuilder class, such as modifying the redirect uri, trying different NuGet packages that go along with Microsoft.Identity.Client (such as .Desktop and .Broker), and also the various methods on IPublicClientApplication, such as WithSystemWebViewOptions, WithUseEmbeddedWebView, etc.
Has anyone else experienced issues when trying to use MSAL with Prism, on UWP specifically? I'm wondering if it is an issue between the two libraries. I have a sample UWP project that does not use Prism, and there are no issues there.
Thanks in advance to anyone that is able to provide some insight on this issue.
I'm migrating simple ASP Web API to Azure Functions, for the first time. The function will take some JSON input, and creates a PDF report with Microsoft.Reporting.WebForms.
Unfortunatly, I get the following error:
Exception while executing function: Functions.HttpTriggerCSharp1. Microsoft.ReportViewer.WebForms: An error occurred during local report processing. Microsoft.ReportViewer.Common: The definition of the report 'D:\home\site\wwwroot\HttpTriggerCSharp1\bin\Test.rdlc' is invalid. Microsoft.ReportViewer.Common: An unexpected error occurred in Report Processing. Microsoft.ReportViewer.Common: The type initializer for 'Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatVersion' threw an exception. mscorlib: The path is not of a legal form.
First I thought that the .rdlc file was not found, but that doens't seems to be the case. It finds the file, but can't handle it, so it seems.
I'm calling the file via:
ReportViewer rv = new ReportViewer();
rv.ProcessingMode = ProcessingMode.Local;
rv.LocalReport.ReportPath = Path.Combine(System.Environment.GetEnvironmentVariable("HOME"), #"site\wwwroot\HttpTriggerCSharp1\bin\Test.rdlc");
I've searched a lot, but can't find specifics on Azure Functions and ReportViewer. Maybe I'm missing something, or I'm trying something that's not possible. Thanks in advance.
From the Azure official document, we could know that ProcessingMode.Local is not supported in the Microsoft Azure.
ReportViewer configured in local processing mode is not supported in Microsoft Azure
The following is the snippet of document, more details please refer to the document.
To incorporate ReportViewer into your Microsoft Azure Web site, you need to complete the following tasks.
Add Assemblies to the Deployment Package
Configure Authentication and Authorization
Publish the ASP.NET Web application to Azure
Update:
According to the link, currently, this library does work with Web Sites and WebJobs, but not with Functions due to the nature of how we load assemblies.
I'm using ASP.NET Core with full .NET Framework and Identity and trying to change the user id type to int. I followed these steps (https://medium.com/#goodealsnow/asp-net-core-identity-3-0-6018fc151b4#.1uxf4m1s8) and it generates right tables and columns to the DB. I get this error when running the code (locally with Visual Studio 2015) and have no idea what to do:
System.Exception: de95f9a1-0d40-4922-a19f-0f300a69955c is not a valid
value for Int32. ---> System.FormatException: Input string was not in
a correct format.
It tries to open the start page but fails before anything is displayed.
It seems to me that some part of the code still tries to use wrong data type for the id but I can't pinpoint what. I have my own SQL database running locally and everything was working fine until I tried to change user id to int.
Perhaps there was Identity data of an old logged user in the cookies. I had the same problem and my solution was to delete all cookies from the site and refresh the page.
I still don't know what was wrong but I just re-cloned the repo to an earlier state and remade the necessary changes as described in the linked article. Now it works. Must've made a mistake somewhere. Thanks for the help.
Hi I hope someone can help me out here.
I have a Web Application (asp.net) on my local machine, I am trying to upload video to YouTube using this sample https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video
I have set up client id and secret for Web application in Google console when I try to upload video a browser tab opens to select one of my google accounts and once I sig in I get redirect_uri_mismatch the response details on that page are below:
cookie_policy_enforce=false
scope=https://www.googleapis.com/auth/youtube.upload
response_type=code
access_type=offline
redirect_uri=http://localhost:55556/authorize/
pageId=[some page id removed here for security reasons]
display=page
client_id=[some unique id removed here for security reasons].apps.googleusercontent.com
one interesting thing is that the redirect_uri=http://localhost:55556/authorize/ is completely different from the one set up in Google console and the one in client_secrets.json also each time I get the error page the port number changes.
redurect urls and origins are set as follows in Google console I think I have added all combinations just in case:
Authorized redirect URI
http://localhost/
https://localhost/
http://localhost:50169/AddContent.aspx
https://localhost:50169/AddContent.aspx
http://localhost:50169
Authorized JavaScript origins
http://localhost/
https://localhost/
http://localhost:50169/
https://localhost:50169/
I am not sure why redirect-uri on the error page does not match any of the
Authorized redirect URI I have specified in Google console ? any ideas ?
Also is it possible that everything is set-up correctly in Google console and my code but this error is triggered by something else like maybe I missed some setting on my you tube account ? I did not make any setting changes since I don't think I have to is that correct ?
Ok I belive that direct video upload to the website owner account is no longer supported in YT API v3.0 according to those posts.
Can YouTube Direct Upload to a Common Account for All Users?
How can I get the youtube webcam widget to upload to one account using API?
Shame, I think I will need to host the videos that users upload on my servers.
However the original issue was fixed by adding this URI to the redirect URIs in the developer console
http://localhost/authorize/
Google OAuth 2 authorization - Error: redirect_uri_mismatch
I got it to work by setting the Redirect URIs to exactly this:
http://localhost:50517/signin-google
Note:
- it does not work with a trailing slash
- port number is whatever your visual studio is assigning
- I set JavaScript Origins to:
http://localhost:50517/
With you, though, would be nice if someone actually documented this somewhere...
You should look into your code where you create the authorization URI. You need pass one of the redirect URIs you registered with Google developer console. I guess you're using some OAuth2 library which uses the localhost:port/authorize as the default redirect URI. The port changes because each time you start your local server, it picks a different port number. To fix it, you should specify a port number when starting it, for example, 8080. Then you should register localhost:8080/AddContent.aspx in Google developer console and pass it to whichever library you use to create the authorization URI.
I experienced a similar problem when trying to setup the quickstart app for the Drive REST API. I kept getting the redirect_uri_mismatch error and the port number with that error kept changing. The fix for me was to change the redirect URI in the Google Developers Console for my app to not include the port number.
There is a really easy way to get round this and I kicked myself when it dawned on me.
I am using "Web Application" credentials - you'll want the credentials manager open btw.
Run the DotNet sample app and let the browser open (I get the "Select An Account" page) - then look in the URL for the redirect URI that's been automatically generated by Google's code something like:
redirect_uri%3Dhttp://localhost:62041/authorize/
Then just go to the credentials manager and add this URL to the allowed list and save. Now select your google account and see what happens - it takes a few minutes for the API to update - if you get the redirect error page just hit back and select you account again - eventually it works and returns back to visual studio.
Once the account has been authorised once it sticks (clear the bin directory to unstick it) but this means you can now put a break point in the code and look at the credentials variable to get the refresh token everyone is so desperately trying to get so that you can persist account connections.
The WSAT throws the following irrespective of the project or the connection type,
An error was encountered. Please
return to the previous page and try
again.
Even on a brand new ASP.NET MVC 2 website where user authentication and registration work through the default account controller without a quibble, the WSAT fails to run.
Things I've tried,
Tried to open it in IE.
Tried to use it with MySQL to setup
user authorization, role and profile
management. This was the goal which
is starting to seem more and more
like an uphill battle.
Tried it with a brand new ASP.NET
MVC 2 application.
Help would be greatly appreciated.
Found it. Apparently the configuration manager will not work if the directory path to the solution contains invalid characters, in my case it was a space.
Should be documented somewhere, this was a good waste of four hours..