How to manually pass a return URL to Action asp.net mvc5

I am creating an ecommerce mvc5 web application. I have an action "ListItem" where Users can list items to sell. I created a custom authorize attribute that checks if user is in seller role and if not redirects the user to a setup action where t

PageData Fails to Send Data to WebMatrix

I am building a website with WebMatrix. I would like users to enter their name in the main page and after redirection their name will be shown in the results of another form. But my code is not working. This is a snippet of the main page: @{ if (IsPo

Get a boolean of a SELECT in SQL Server in a boolean in C #?

I have this code in my SELECT: SELECT A.CompletedDate, CASE WHEN (@AdminTestId IS NULL AND @UserTestId IS NULL) THEN 0 WHEN (@AdminTestId = temp.AdminTestId AND @UserTestId = A.UserTestId) THEN 1 WHEN (@AdminTestId = temp.AdminTestId AND @UserTestId

ASP.NET Hyperlink control does not navigate to the URL

I have a hyperlink that does not navigate to the set URL. It is dead simple I have no idea what is wrong. The link in my aspx page: <asp:HyperLink ID="HyperLinkLostPass" runat="server" Text="Forgot username or password?" N

Asp.net Panel Control Visibility Problem

I have written a code which checks unique ID availability status.. if ID is available it should make panel visible otherwise the panel visibility is hidden. But it is not working. If i set panel visibility to false in page load it works.. but panel v

How to pass data from one control to another control?

I have a asp Literal element that I want to pass to an object control to set its data property so that it pulls a filename from a database. Here's what I got: <asp:FormView ID="Formview1" runat="server" DataSourceID="AccessData

scrolling in gridview

I've one grid view which is having 4 columns --> Food Type,Dish Name, Price, Quantity. The "Food Type" column has values "French,Chinese,Italian" "Dish Name" column has the name of dish for respected food type for ex. for

Send an HTTP request via ASP.NET C #

Am trying to send HTTP Get request via C#. But it seems not working. Here is my work. And i wanna from you the corrections needed to make it work ! String Mobile = txt_phone.Text; String Message = "You have registered successfuly."; Uri targetUr

How can I display an image from SQL Server using ASP.NET?

Here is my class (product.cs) where is the method to insert the image: public static void InsertProductIMG(byte[] image, string contentType) { string cs = "Data Source=(local);Initial Catalog=myApp;Integrated Security=True"; string comandoSql =

MVC3 OutputCache VaryByHeader = The cookie is not defined

I have the following action method: [HttpGet, Authorize, OutputCache(Duration = 60, VaryByHeader = "Cookie", Location = OutputCacheLocation.Any)] public ActionResult Index() But when I make a request, these are the headers issued: Cache-Control:

Can we convert text in XML format to internal XML format?

I want to pass xml formatted text to inner xml text. Is it possible? XmlNode parentNode = myTemplate.CreateNode (XmlNodeType.Element, "Parent","myns"); XmlNode childNode = myTemplate.CreateNode(XmlNodeType.Element, "head", &q

Min-Width table

I am attempting to create a min-width table of 500px with a cell containing a textarea with a min-width of 300px. The table's min-width doesn't seem to be working at all. I'm using CSS to style the table and the textarea. Is this a known issue? I've

Why is there an extra line in GridView?

I am trying to bind a grid to the following data source. Why do i get an extra row in there when there is not data in it? The count of the rows is also correct , i can see that when i debug . Object[] users = new Object[100]; int i = 0; while (reader

What is the correct use of RedirectPermanent?

I am working on an eCommerce site that passes product ids in the query string. I just had to fix an issue where the product page didn't check the status of the product (live or archived) so if the user had a direct link e.g. a search result, the prod

SQL dataset to JSON

Alright I have been trying to figure this out and I read the MSDN page on the JavaScriptSerializer. However, I still can't figure out how to get this to work on an asp.net page. I want to convert my dataset into a json string so I can graph it using

Problem pulling data from the website in .NET and C #

I have written a web scraping program to go to a list of pages and write all the html to a file. The problem is that when I pull a block of text some of the characters get written as '�'. How do I pull those characters into my text file? Here is my c

Browser based online gambling question

I am developing a small browser based game in asp.net. Think of a game room which has a capaticy of 22 players and players join the room by clicking a button. ( I am saving the number of players in the room in database) I need to call a method when t

View the text returned by json after the call

I have the following javascript: $.post("/Authenticated/DeletePage/" + PageId); showStatus("Page deleted...", 10000); I would like to instead pass showStatus() text that is returned by the $.post() call, rather than hardcoded text. How

two forms with the same login in asp.net mvc

I have multiple forms on a page which pass an id to the controller via hidden inputs. As I am using strongly typed views for these I think I need to keep the Id for each of these to be the same. It works currently though I think it's bad practice. Ho

ASP.Net: Using UpdatePanels in a GridView

I'm trying to build a sort of Accordion effect using a GridView and UpdatePanels. And I have problems with tieing everything together: <asp:GridView ID="gridMain" runat="server" ... > <Columns> ... <asp:TemplateField Sho

How to allow writing to a file on the ASP.net server

So I have file that is in folder in website folder structure. I use it to log errors. It works when ran from Visual Studio. I understand the problem. I need to set permissions on inetpub. But for what user ? and how? I tried adding some IIS user but