asp.net

Securing controllers in ASP.NET MVC to the correct user

I am building an application in ASP.Net MVC to log tasks. A user can delete only their own tasks. Is there a standard way to prevent a different logged in user, from simply typing in the delete controller url, with an [id] parameter of a task that belongs to another user, thus deleting another users task? Example: User A has a task wi...

ASP Themes: Skin Localization

Hi, Is any way to localize text in .skin file (asp.net theme)? Thanks ...

Can I call a variable from my .NET codebehind page in the actual aspx?

Say in my codebehind .cs file, I set a variable: protected void Page_Load(object sender, EventArgs e) { int x = 2; } I want to display this dynamically in my aspx page. But this code won't work: <% Response.Write(x); %> How can i accomplish this? Is there any way to pass variables? ...

TextChanged event only fires when I put my cursor in the textbox and change the text

I have a TextChanged Even on a textbox and when I enter data into it, it updates another textbox which in turn is supposed to fire a TextChanged Event, but it is not firing until I put my cursor in the TextBox. Is there a solution to this? Code for updating the Extended Price when Qty Changes: protected void txtQty1_TextChanged(object...

Cache-Control Headers in ASP.NET

I am trying to set the cache-control headers for a web application (and it appears that I'm able to do it), but I am getting what I think are odd entries in the header responses. My implementation is as follows: protected override void OnLoad(EventArgs e) { // Set Cacheability... DateTime dt = DateTime.Now.AddMin...

Populating TreeView with XmlDataSource without saved file

I have a .cs file that builds an xml document and stores it in a variable. I want to "inject" it into my <asp:XmlDataSource> so that I do not have to save each xml file (it is different every load). How could I go about this? In my codebehind cs file, I have: XmlDocument x = blahblah XmlDataSource MySource = new XmlDataSource(); MyS...

Post to Facebook Page via ASP.NET

I've seen this and this but before I sink a ton of time into it, I want to know if what I'm trying to do is possible. I have a Page on FB (not a profile, but a Page for business, websites, etc) and I want to post a story to it via my site automatically. I don't want to do anything else but that. I don't want to create an app (if I don't ...

Been a LAMP developer for years, now transitioning to the Microsoft Web Stack. Where do I begin?

I've always worked with the standard Linux web stack (linux, apache, php, python, mysql) but have been given a great job opportunity working with a group that works with the Microsoft Web Stack (IIS, ASP.NET, MSSQL, C#). There seems to be a pretty good Microsoft following here on SO. Where should I begin? Specific books, tutorials, on...

GridView control with two asp:Command columns using the same command

I have an ASP.NET GridView control with two asp:CommandField columns that are both using the Select command to perform different tasks. How do I distinguish which column was selected in the OnRowCommand event when both return "Select" when I check the CommandName property of the GridViewCommandEventArgs object? Here is my source code: ...

Network Service user vanished on IIS7.5 on Windows7

I'm installing the ASP .net on Win7, and I need give permission to ASP .net to use the project folder. I have tried Network Service and didn't work; Win7 didn't find that user. I know that previously the user was ASPNET and later is Network Service, but now, something changed or I'm doing something wrong. Please help me. Edit: *I lear...

Can SMTP Errors be the Developer's fault?

I have an error message getting returned to me which would appear to be something wrong with the Exchange set up. Is there a possibility that I'm doing something wrong? I have no idea where to to start to track this down: The following recipient(s) cannot be reached: Customer Service Account on 6/3/2009 11:00 AM There was a...

The best way to return the results from server to mobile client

I'm creating a database application using ASP.NET and I want to make a Windows Mobile client. It should go like this - user opens the WM client, enters the text which he's looking for, the client then opens URL like Search.aspx?text=MyText and the WM client then says "Text Found" (if really found). And here's the problem. I don't know wh...

IHttpHandler to post to a form

Is it possible to post to a form from pure code behind in ASP.NET? Basically I need to simulate a Response.Redirect() but do so with a POST instead of a GET and also set a couple Request parameters. This would all be happening in the ProcessRequest method on a HTTP handler. Notes: I realize that Response.Redirect really just throws the ...

Hook a javascript event to page load

I have an aspx that has the following javascript function being ran during the onload event of the body. <body onload="startClock();"> However, I'm setting the aspx up to use a master page, so the body tag doesn't exist in the aspx anymore. How do I go about registering the startClock function to run when the page is hit and still hav...

Safari - showing expired .NET Page

We have a strange problem in Safari. When the user logs out of our Web Application we expire the forms authentication with the following FormsAuthentication.SignOut(); Session.Abandon(); This works fine in IE and Firefox (when the user hits the back button they are presented with a page expired message and are forced to login) but ...

Asp.Net Login Control very slow initial connection to Non-Trusted AD Domain

ASP.NET Login control is very slow making the initial connection to AD when authenticating to a different domain than the domain the web server is a member of. Problem occurs for the IIS server and when using with the Visual Studio's built in web server. It takes about 30 seconds the first time when attempting to use the control to conn...

RequiredFieldValidator not firing when ControlToValidate visiblity is changed

When I change ddl.Visible=true(it gets changed on partial postback/updatepanel from another form element event)the RequiredFieldValidator will not fire? NOTE: This is not a question on how to use the RequiredFieldValidator in a normal circumstance. My form has cascading dropdowns that are all dynamically built with their visibility tog...

ASP.NET Localization Issue

I have succesfully added localization to my website. Came next day and it does not work. After reading alot of posts and did some troubleshooting my self. I found out that the Page ignores the page.aspx.en-US.resx. Because I dont have a standard resx for the page it shows the label caption i have in the designer. I just took out the en-U...

Connection to SQL is not closing after call to DB in ASP.NET

I have a generic method to call a stored Procedure in ASP.NET: public SqlDataReader ExecuteStoredProc(string sprocName, SqlParameter[] SqlP) { SqlDataReader iReader; SqlCommand sql = new SqlCommand(); sql.CommandText = sprocName; sql.CommandType = CommandType.StoredProcedure; ...

ASP.NET stream content from memory and not from file

The users have requested the option to "download" a csv file representation of GridView contents. Does anyone know how to do this without saving the file to the server but rather just streaming it to the user from memory? Thanks ...