Search the Community
Showing results for tags 'asp.net'.
-
Hi All, I have being looking into authentication to use on API I am working on but I lack experience in this area. I have developed an ASP.NET Core application that is hosted on Azure. Is there a way to integrate authentication for clients I define within the Azure Portal? I want that we create a client within Azure and we provide them with a Secret Key to use in order to obtain an access key that Azure Provides. The secret key would be used within the Header of a HTTP Request. Currently I have created authorization using the likes of a Microsoft account to signin with but because there will be no front end area to sign into, I'd like to be able to manage the secret keys from Azure. I hope this makes sense and someone can point me in the right direction. Thank you in advance!
-
Hello, I have a Class CLASS1 containing multiple Strings, a String array and an Array of CLASS2 CLASS2 contains a String and an Integer, I currently store CLASS1 objects by Serializing them into XML and Deserializing them when I need to read them, but I want to be able to filter them more easily using SQL how can I store them in a way that I can read and filter them using one SELECT command, like I would when deserializing the xml document. The size of the Arrays isn't fixed I tried storing the two arrays in their own tables conecting them using foreign keys to the table were the rest of Class1 values are stored, but when I read them I get an extra output for every Element in each of the arrays, but I want just one output containing every element of both arrays and the other values from Class1
-
So I am currently writing an Asp.net website to track your inventory for an RPG, so I need to read the values for the items, now im wondering what would be the better format to store the items in. I have an class Item consistiong of multiple strings, ints and string[]s this file/table would not be written to by the user the program just needs to filter it to find the right item.
-
Hello, I am currently developing an Asp.net application I am developing it on windows using Visual Studio 2019, how do I easily make a Docker image that I can run on Linux? Thanks in advance
-
Hey all together, So I have this weird Error going on inside my Visual Studio right now. Me and my coworkers decided to set up a onPrem Gitea for our company where we push our source code onto for better source control. This worked totally fine but then at some random point in time, my VS crashed and ever since them in not able to push my locally created commit-branch to the remote repository. The project template is an Blazor Server App running with ASP.NET Core 6. This problem only occured on my Notebook / in my VS, every other installation we have running on the machines of my coworkers are fine and still able to push and fetch to and from our remote repo. The errormessage my Output prompt of VS is giving me says the following: Error encountered while pushing branch to the remote repository: Git failed with a fatal error. Git failed with a fatal error. Custom certificate bundle not found at path: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt Custom certificate bundle not found at path: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt Custom certificate bundle not found at path: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt cannot spawn askpass: No such file or directory could not read Username for 'http://IP.Adress.Of.Our.Server': terminal prompts disabled Failed to push the branch to the remote repository. See the Output window for more details. Im running the following os/versions: Windows 11 Visual Studio 2022 (v17.1.1) Gitea-Version: 1.15.6 I'd be super happy if someone can help me with that. If you need addtional information, please let me know. Cheers Nightcore
-
asp.net Object reference not set to an instance of an object
SoftwareNinja posted a topic in Programming
Hi all, I am working on an .net Web Application. I have created a class known as "MODELS" which has a String Variable and a String IList Variable. Within my Search.cshtml file up the top I am trying to create a list using this object but every time I add something to the IList I get an error. Error when loading the page. The app allows me to populate the brand but not the list? how can I resolve this? Thanks in advance and look forward to hearing back from you all. Cheers. -
so i have a read only textbox that displays text from a column in the database.if there is a lot of text to be shown i have to manually scroll down it to see the remaining part.is it possible to automatically expand the textbox according to the amount of content to be displayed? Any help would be greatly appreciated.
- 3 replies
-
- database
- visual studio
-
(and 3 more)
Tagged with:
-
i need to display a error message if the user tries to input numbers to a text box,is it possible to do this?
- 2 replies
-
- programming
- html
-
(and 3 more)
Tagged with:
-
if anyone could tell me a way to get date from DB and convert it to date/month/year format in ASP.NET it would be very helpful. The data type of the date column in the db is date, so when i retrieve it and display it in a textbox i get the time as well.i found a code to convert in the internet but i get a error saying: String was not recognized as a valid DateTime. This is my code cn.Open(); string supdate = "SELECT Date FROM Payroll WHERE EmpID='" + empid + "'"; SqlCommand query2 = new SqlCommand(subdate, cn); SqlDataReader reader2 = query2.ExecuteReader(); reader2.Read(); String sdate = reader2["Date"].ToString(); reader2.Close(); cn.Close(); String conv = sdate; // get value from text field DateTime suDateTime = new DateTime(); suDateTime = DateTime.ParseExact(conv, "MM-dd-yyyy", null); String converted_date = suDateTime.ToString("dd-MM-yyyy"); TextBox4.Text = converted_date;
- 5 replies
-
- programming
- database
-
(and 2 more)
Tagged with:
-
html Having trouble displaying images in html using img tags
Shammikit posted a topic in Programming
i have a image in a folder in my pc that i want to display in my web page. i have tried the code below but i havent been successful. what am i doing wrong? <img src="C:\Users\guest\Desktop\folder1\Images\Dell-Vostro-2.jpg" width="200" height="200" />- 9 replies
-
- programming
- web development
-
(and 3 more)
Tagged with:
-
asp.net Need help to get a String value from one aspx to another
Shammikit posted a topic in Programming
i have 2 aspx.cs files know as messages.aspx.cs and reply.aspx.cs. i want to pass a value of col1 variable from message to reply. i have tried the code below and im unable to find whats wrong with it. im getting an error saying: Error 23 A field initializer cannot reference the non-static field, method, or property 'Test_website.Reply.rv'. What am i doing wrong? ------------------------------Messages.aspx.cs-------------------------------------------------------------- public partial class Messages : System.Web.UI.Page { static String col1; protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { col1= GridView1.SelectedRow.Cells[1].Text; } public string rt() { return col1; } ----------------------------------------------------------------------------------------------------------------- ---------------------------Reply.aspx.cs--------------------------------------------------------------------- public partial class Reply : System.Web.UI.Page { Messages rv= new Messages(); string v = rv.col1; }- 1 reply
-
- visual studio
- microsoft
-
(and 3 more)
Tagged with:
-
i want to display a image and some text from my database when my web page loads.i have tried the code below so far to practice but it hasnt worked.i couldnt still identify what is wrong.what could be the problem? ----------------------------------------------------------Page1.aspx------------------------------------------------------------ <form id="form2" runat="server"> <div> <asp:DataList ID="DataList2" runat="server"> <ItemTemplate> <table> <tr> <td> <img src="<%#Eval("image") %>" height="500" width="100" /> </td> <td> <%#Eval("des") %> </td> </tr> </table> </ItemTemplate> </asp:DataList> </div> ----------------------------------------------------------------------------------------------------------------------------- ---------------page1.aspx.cs---------------------------------------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { cn.Open(); SqlCommand cmd = cn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from products"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); DataList1.DataSource = dt; DataList1.DataBind(); cn.Close(); } ---------------------------------------------------------------------------------------------------------------------------
-
- web designing
- pogramming
-
(and 3 more)
Tagged with:
-
i want to pass the value typed in textbox of page 1 to a variable in page 2 for some calculation how can this be done? i have tried the code below but it gives me an error saying i cant access that textbox because of its protection levels.i went to change its access modifier from its properties but an option like that was not available. //me trying to access textbox1 of aspx page 1 from page 2 Form f1 = new Form1(); String x = f1.TextBox1;
- 1 reply
-
- visual studio
- programming
-
(and 2 more)
Tagged with:
-
im making a website using asp.net and i want to put a parallax scrolling effect to my webpage.i need to put a background image for ever div im using but the code im trying doesnt work.can someone please explain why? this is my code: <style> .parallax { /* Set a specific height */ min-height: 80px; /* Create the parallax scrolling effect */ background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; } </style> <body> <div class="parallax"></div> <div style="background-image: url('lake_resort.jpg');height:1000px;font-size:36px"> Scroll Up and Down this page to see the parallax scrolling effect. This div is just here to enable scrolling. </div> </body>
-
So here is the issue (this is happening to 2 separate web applications by the way): We are trying to set up windows authentication for an intranet site, we have successfully set up other web site projects using this kind or authentication, but now that we are using web application projects (with windows authentication) we are suddenly having issues. The web application is asp 4.5, the server is running asp 4.6. We have windows authentication turned on for web.config and for iis, but some users are getting prompted for login when we have internet explorer set for background windows authentication. The most strange part about this is that some people with credentials and some people without credentials are getting prompted for login while others this doesn't happen at all and they arrive at the proper web page. I am not certain at this point what is causing this to happen. We ended up switching one of the web applications to a web site project, and it suddenly works. For some reason the web application project is having difficulty with windows authentication, while web site projects work just fine with it. When looking through the logs for IIS I discovered the following errors for one user who was having difficulty with the windows authentication: 401 0 0 15 and 401 2 5 0. Any ideas on what is causing thisI have looked far and wide to find what is causing this to no avail. Any help would be greatly appreciated.
- 2 replies
-
- asp.net
- windows authentication
-
(and 2 more)
Tagged with:
-
Hi, so, I know this probably isn't the best place to ask this but had no luck on StackOverflow (as usual...) and this is generally the most helpful forum so far for other stuff so imma try my luck here. I've been trying to implement Steam authentication in my ASP.Net web app (ASP.Net Framework 4.8, MVC 5) using Owin and its Steam auth provider (Owin.Security.Providers.Steam). I'm sure there is a better way to do it, and if you know of one, please suggest it. Followed a couple of tutorials for a similar authentication system but using GitHub and re-adapted that code to be used for login with Steam. Everything is working fine with a couple of logins but after some time it just breaks and wouldn't authenticate properly. I'm new to Owin and authenticating users with it so any tips on what I should do to debug it or anything related to Owin that I misinterpreted would be helpful. I don't know how to explain much of the problem, I was trying to debug it but instead of fixing it I just got more confused, here is my code (only relevant parts): HomeController.cs public async Task<ActionResult> Login() { // This is always null after a couple of succuessful authentications var authenticateResult = await HttpContext.GetOwinContext().Authentication.AuthenticateAsync("ExternalCookie"); if(authenticateResult != null) { var firstOrDefault = authenticateResult.Identity.Claims.FirstOrDefault(claim => claim.Issuer == "Steam" && claim.Type.Contains("nameidentifier")); var idString = firstOrDefault?.Value; var match = _accountIdRegex.Match(idString ?? ""); if (match.Success) { var accountID = match.Groups[1].Value; var steamID = ulong.Parse(accountID); // User Management Code return RedirectToAction("Index"); } } return RedirectToAction("LoginSteam"); } public ActionResult LoginSteam() { return new ChallengeResult("Steam", Url.Action("Login")); } ChallengeResult.cs internal class ChallengeResult : HttpUnauthorizedResult { public ChallengeResult(string provider, string redirectUri) { LoginProvider = provider; RedirectUri = redirectUri; } public string LoginProvider { get; set; } public string RedirectUri { get; set; } public override void ExecuteResult(ControllerContext context) { var properties = new AuthenticationProperties { RedirectUri = RedirectUri }; context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider); } } And Startup.cs [assembly: OwinStartup(typeof(ApplicationNamespace.Startup))] namespace ApplicationNamespace { public class Startup { public static string steamKey = ""; public void Configuration(IAppBuilder app) { app.SetDefaultSignInAsAuthenticationType("ExternalCookie"); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = "ExternalCookie", AuthenticationMode = AuthenticationMode.Passive, CookieName = ".AspNet.ExternalCookie", ExpireTimeSpan = TimeSpan.FromMinutes(5) }); var webconfig = WebConfigurationManager.OpenWebConfiguration("~/"); #if DEBUG steamKey = webconfig.AppSettings.Settings["steamApiKey"].Value; #else steamKey = webconfig.AppSettings.Settings["steamApiKeyRelease"].Value; #endif var options = new SteamAuthenticationOptions { ApplicationKey = steamKey, }; app.UseSteamAuthentication(options); } } } From what I found online, this should be universal and work with any provider, be it Google, Steam, GitHub etc. and it does... for a while... then AuthenticateAsync starts returning null each time and that is where I get confused. I couldn't find anyone having a similar problem to this online, so I would guess that something is wrong with my code instead of Owin or IIS configuration, what are relevant IIS configs that I should check before testing this again? Thank you up front for anyone that tries to help, it means a lot!
-
hello, im using the following code to create a user account and this creates accounts with "user must change password at next logon" option checked. i dont want it to do this, I want my passwords to be permanent. how can i achieve this programmatically in ASP.NET. Thanks try { string oGUID = string.Empty; string connectionPrefix = "LDAP://" + ldapPath; DirectoryEntry dirEntry = new DirectoryEntry(connectionPrefix); DirectoryEntry newUser = dirEntry.Children.Add ("CN=" + userName, "user"); newUser.Properties["samAccountName"].Value = userName; newUser.CommitChanges(); oGUID = newUser.Guid.ToString(); newUser.Invoke("SetPassword", new object[] { userPassword }); newUser.CommitChanges(); dirEntry.Close(); newUser.Close(); } catch (System.DirectoryServices.DirectoryServicesCOMException E) { //DoSomethingwith --> E.Message.ToString(); }
- 6 replies
-
- asp.net
- programming
-
(and 1 more)
Tagged with:
-
hello, i have created a user account using ASP.NET using the command below. public string CreateUserAccount(string ldapPath, string userName, string userPassword) { try { string oGUID = string.Empty; string connectionPrefix = "LDAP://" + ldapPath; DirectoryEntry dirEntry = new DirectoryEntry(connectionPrefix); DirectoryEntry newUser = dirEntry.Children.Add ("CN=" + userName, "user"); newUser.Properties["samAccountName"].Value = userName; newUser.CommitChanges(); oGUID = newUser.Guid.ToString(); newUser.Invoke("SetPassword", new object[] { userPassword }); newUser.CommitChanges(); dirEntry.Close(); newUser.Close(); } catch (System.DirectoryServices.DirectoryServicesCOMException E) { //DoSomethingwith --> E.Message.ToString(); } return oGUID; } This makes the account, however it creates disabled accounts and i have to enable it manually for it to work. I have tried the command below to enable the created account but it is giving me the error on the screenshot. public void Enable(string userDn) { try { DirectoryEntry user = new DirectoryEntry(userDn); int val = (int)user.Properties["userAccountControl"].Value; user.Properties["userAccountControl"].Value = val & ~0x2; //ADS_UF_NORMAL_ACCOUNT; user.CommitChanges(); user.Close(); } catch (System.DirectoryServices.DirectoryServicesCOMException E) { //DoSomethingWith --> E.Message.ToString(); } } i have been searching for fixes for hours now but haven't had any luck. would really appreciate if someone could help.Thank you
-
Anyone have any experience working with ASP Web API. I'm using lazy loading and get a stack overflow error when trying to send an object. I know this is because of the infinite loop caused by lazy loading and I was wondering the best way to fix this. I know you can use data transfer objects but I was wondering if there are any better way.
-
ASP.NET account and Windows 10 (delete it... or not delete it, that is the question) why i want delete it ? easy, i have not created it and i do not want it 1) why we should not delete this account ? 2) did any of you delete this account ?
- 4 replies
-
- asp.net
- windows 10
-
(and 1 more)
Tagged with:
-
So, the title may be not that clear, but I'm working on a web store. This is pretty much the first time I'm ever making something like this. I've experience in HTML & CSS, C# and SQL, So I was thinking of doing it like this: Make website using HTML & CSS (And JS maybe, which I still need to learn), and use ASP.NET (for which I can use C#) for the backend, with a mySQL database. I'm not sure, however, if I've even got everything I need, and I'm not sure I entirely understand the way this works. Do I make the website in plain HTML/CSS first? Is mySQL even compatible with all this (quick search says yes)? Do I have everything I need, or am I missing things? I could use some clarification here, thanks in advance!
-
Hey all, I'm looking to chat with someone who has some experience using reflection in MVC applications. Basically, I'd like to annotate a few controller actions with two strings that I can get a unique list of and link to user accounts. The concept behind it is, I annotate an action like so: [ActionEvent("Group Name", "Event Name")]public JsonResult MyEventMethod(int id){...} On startup, generate a list of these action events and store them in a table with id's etc.. I then want to be able to link these action id's to a user, so in the user control view, render a check list of them and add/remove the link as appropriate. When an action with an action event annotation is called, I want it to be able to check it's own annotation and get a list of users with links to that annotation. I then want to use that list of users in that event. In lamens terms I want to create a "subscription" to that method call, that users can optionally be "subscribed to" and receive notifications when that method call is run. Hope that makes sense :blink: If anyone can offer up some advice that would be awesome!
- 1 reply
-
- mvc
- relfection
-
(and 2 more)
Tagged with:
-
Hi all, I'm looking to see if anyone can help with an issue I'm having trying to publish to a local IIS server. I have an application I have developed that, when I run it on my DEV workstation under IIS Express, it works perfectly. But when I publish it, the application suffers Internal Server Errors and I'm not sure why. I've checked the event log and solved an issue with the user the site is being run under, not having access to the app pool, but no further log entries are being generated. Attempts to set debug flags and show the stack error after being published only show me an internal server error has occured in plain text, no 500 response or anything. I'm publishing from a Win8.1 Enterprise workstation with Visual Studio 2013 Premium, to a local Win 2012 R2 Standard server. Even publishing the stock Web Application project, it runs but trying to get it to DO anything returns an error. So I'm stumped on what to try next.