MVC :: Wrong URLs Retrieved With GetVirtualPathForArea And GetVirtualPath?
Dec 6, 2010
I am teaching myself MVC 2 and using the MVC paging project code from Martijn Boland, located here:
[URL]
The code works great if I use the default routing for my project, but I'm using shortened URLs for a couple of views, which is resulting in the wrong page links being retrieved for one of them.
I have a weird thing happening. I have two identical databases installed on one virtual machine but under two different instances of SQLServer. For some reason, periodically when saving from one it will save to the other instead. Using debug, I have verified that the connection string is correct and when the item saves, it still saves to the wrong database.I use session variable, and am of the belief that it might have something to do with it...and t hat when I go from one to the other it is still getting the connection string form the other for some reason.To make sure that it isn't a problem, I make sure that I completely close out one database before opening the other in a new IE window.I assume that when I completely close out an internet explorer window that it abandons all session states. Is that true?
i have a function that pulls URLs from various web resources. needless to say some are full valid URLS and some are relative as per the HTML of the page. below is my asp.net/ c# logic i derived for examining the URL and then generate a full usable URL from whats pulled from the site...
NOTE: origianlurl is the full url of the first searched page, and relativeUrl is a url found within the searched page (it can be a full www.site.com or a /contactus.html) private string ResolveRelativePaths(string relativeUrl, string originatingUrl) { if (relativeUrl.StartsWith("http") || relativeUrl.StartsWith("www")) return relativeUrl; if (relativeUrl.StartsWith("/")) { //get main url something.com [code]...
I have a very weird thing happening. I have two databases that have exactly the same tables but different database names on the same virtual machine, but in different instances of SQL Server. For some reason, when using one of them, it will save to the other. In debug, looking at my connection string..I have verified that it is correct, yet when I allow the save, I look in the table and it isn't there, it is in the other database that is in a table with a completely different name and in a different instance of SQL Server.
I am having a hard time implementing "Remember Me" functionality in an MVC application with a custom principal. I have boiled it down to ASP.NET not retrieving the authentication cookie for me. I have included a snaphot below from Google Chrome.
Shows the results of Request.Cookies that is set within the controller action and placed in ViewData for the view to read. Notice that it is missing the .ASPXAUTH cookie Shows the results from the Chrome developer tools. You can see that .ASPXAUTH is included here.
Does anyone know what the issue may be here? Why does ASP.NET not read this value from the cookie collection?
My application uses a custom IPrincipal. BusinessPrincipalBase is a CSLA object that ust implements IPrincipal. Here is the code for that:
[Code]....
I do not think that any of this is related because the bottom line is that the Request.Cookies does not return the authentication cookie. Is it related to the size of the cookie? I heard there are issues to the size of the cookie.
UPDATE: It seems that the issue revolves around subdomains. This site was being hosted with a subdomain and the cookie domain was left blank. Does anyone have any pointers on how I can get the auth cookie to work with all domains (e.g. http://mydomain.com, http://www.mydomain.com, and http://sub.mydomain.com)?
I hope I can explain myself properly. What i'd like to do is be able to add a Search form where users can search various criteria based on my Orders table. I was hoping to add the capability to click on one of the OrderID's to display the fields from the Orders in the various text boxes on my form. This would allow the users to search, and update all in the same page. I have the data retrieval portion down pat, but am not really sure how to give them useful links. Is this possible? Or is there a better approach that I could take?
Dim reader As SqlDataReader reader = cmd.ExecuteReader Dim XML As String = reader("records").ToString
I've executed the command in SQL server and I get a result string with length of 54781But when I execute it via .NET and assign it to the XML variable, the length of XML is always 2033...so now Im thinking that the result column "records" cannot exceed this length for some reason...
I recently installed the latest Oracle Data Provider for .NET(ODP.NET 11.2.0.1.2), due to the fact that Microsoft Oracle Client is deprecated. Ever since the new installation, my SqlDataSource control stopped working. When I try to configure the data source of the SqlDataSource and test the connection, it always gives me the following error message:Database schema could not be retrieved for this connection. Please make sure the connection settings are correct and that the database is online.
OCIEnvCreate failed with return code -1 but error message text was not available. at DataObjectSupport(721,6)
I know for sure the connection settings are definitely correct and the database is online for sure, because any databinding I did manually works perfectly well. I can manually bind to a Gridview, ListBox controls and display the data without any problem. The only problem I have is using the SqlDataSource. This is painful because Gridview and Listview have a lot of cool built-in features. When you databind the controls in the code behind file, you lose all the features.
I have added ASPNET to the Oracle home directory and granted it full control access and retarted the computer but it doesn't work. I'm using Visual Studio 2010 and the database is Oracle 10g. Does anybody know why I'm having problem with SqlDataSource only?
I have an article table, I am using the login mechanisms provided my MVC2 , since it contains all the required functionalities that i need.(but i do not know what are the database tables that store these information) What i need is to display all the articles created by the login user. currently i am retrieving all the articles from the articles table , as i am not able to retrieve the login name to add it to the following query . the query code looks like this (which is part of the repository class which i have created):-
public IQueryable<Article_Type> FindUserArticle() { return from article in db.Article // where article.createdby >= ??? orderby articletype.Article_Type_Id select articletype; }
At a certain point in my program, I successfully re-set some of the Header titles programmatically:
Code: Private Sub dgAccountability_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgAccountability.ItemDataBound If e.Item.ItemType = ListItemType.Header Then Dim previousYear As Integer = (Integer.Parse(year) - 1) e.Item.Cells(1).Text = "YTD Hours " & previousYear.ToString
When the data is retrieved through a stored procedure using the SQLDatasource control that is binded to a gridview control, I want to change some data that is in some of the columns. Can i do this in one of the events either in the gridview or data control? I know you can do some formatting on the aspx page side such as dates, etc. but was wondering if I can do it on the vb code side?
I need to asynchronously retrieve several resultsets which I store in DataTables and add these DataTables to a DataSet. When the final DataTable is filled and added to the DataSet the page must then continue processing utilizing this DataSet I have figured out how to implement delegates to asynchronously retrieve my DataTables but I'm unclear how to add them to a DataSet in a thread-safe manner. How is this best accomplished? Before processing I know how many DataTables there will be, so what is the best way to track the progress of the asynchronous retrievals and allow the page to continue only after I have all of the data?
when designing E-commerce website or shopping cart we call session value from login and we use it anywhere we need,but i want to know how session values are remembered and retrieved??i mean where they are stored and how it will be accessed
How it is possible to assign datatype of an attribute retrieved using sql query to a string? for eg:
SqlCommand cmd = new SqlCommand("select data_type from information_schema.columns where table_schema='dbo' AND table_name=table1 AND column_name=column1, con);
I want to assign this datatype value to a string. How it is possible?
What i need to do is to make one of the cells change colour depending on the result. So say if the What column showed 1, 2 or 3 or would show in the table red green or amber.
I have this asp.net website that generate records of Staff. As you type staff's Id no. in a texbox and click the 'Generate record' button, the page will be redirect to the another page of which the report has to be viewed.
In my first aspx.cs (session.aspx):
[Code]....
I have my report.rpt which I have already populated with designated fields like:
Staff_No, First_Name, Middle_Name, Last_Name
Also, I have already drag the CrystalReport Viewer from toolbox in my second page.
That's all what I have done. Any thing that I forgot to do, I do not know.
I got no errors. But when I run it in the browser, the report does not displayed in the browser and I got this "The parameter is incorrect" text at the end of my browser.
-- I'm using SQL server for my database, Visual Studio 2008 (C#) for the codes and everything..
I need to asynchronously retrieve several resultsets which I store in DataTables and add these DataTables to a DataSet. When the final DataTable is filled and added to the DataSet the page must then continue processing utilizing this DataSet I have figured out how to implement delegates to asynchronously retrieve my DataTables but I'm unclear how to add them to a DataSet in a thread-safe manner. How is this best accomplished? Before processing I know how many DataTables there will be, so what is the best way to track the progress of the asynchronous retrievals and allow the page to continue only after I have all of the data?
I want to create a Tree View using XML that is fetched from SQL Server. How I can directly assigned to tree view, the below code I tried, but throwing error 'dsXML' is not an IHierarchicalDataSource. The XML heirarchy is proper. When I use XmlDataSource with the xml file, tree view is shown.
I apologize if this is the wrong sub-forum for this question, if it is please let me know a better sub-forum to ask this.Anyway, I have a table in my database with a photo column that points to the location of images all under the same root, like this: Y:playerPhotosplayerName.jpg
When I select a specific photo using a stored procedure in my aspx.cs, then read the image path using a sqldatareader like this
while (sdr.Read())
{
string filepath = sdr.GetString(0);[code]....
it works fine and the image shows in Internet Explorer (version 8), but doesn't show in Firefox (version 3.6.4) I think it has to do with the direction of the slash, but I'm not sure. Is there anyone out there that has run into this broswer problem?Basically is there a solution to changing the value of the image's filepath string if the browser is Firefox?
Having a problem with autocomplete I put autocomplete control with textbox For data to be retrieved from database, I am putting .asmx file and .cs file for that Now I am giving .asmx file path in autocomplete. asmx file contains path for .cs file If this is the situation, autocomplete dont work and in .cs file , event is not fired.
But if i put that event from .cs file directly into the codebehing file of that control, then it works ok
How can i call an event in .cs file that is placed inside a app_code folder seperately from .aspx and .cs file of the autocomplete control
I was wondering if anyone knows a jQuery library that can suit my needs:
I want a slideshow of album covers which are retrieved dynamically from the database. I want to display 4 album covers at a time. I want there to be a next button so the the slideshow can continue. Here is what I cant find any librarys for. When I click the next button, I dont want to show another 4 different covers, i want it to move along by 1 album cover,
So say I had covers 1 , 2 , 3 , 4
When i click next i want to display 2 , 3 , 4 , 5.
Finally, I want the show to be able to repeat so at the end it starts at one again.
So say I only had 5 covers 1 , 2 , 3 , 4 , 5
when I click next while showing 2 , 3 , 4 , 5 I want 3 , 4 , 5 , 1 displayed.