|
Did you every look at your question after posting, that how it is look like ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
You can easily use ASP Membership with a SQL database. You were on the right track by updating the web.config with a connection string to the sql server. The only step you need to take after that is running aspnet_regsql.exe . This file is located in C:\Windows\Microsoft.net\Framework\v2.0.... When you run the aspent_regsql.exe it will bring up a wizard that allows asks you for your database server and login credentials. This will create all the necessary tables you need for ASP.Net Memberships in your database. After that you should be good to go. Also this msdn link is very helfuull
http://msdn.microsoft.com/en-us/library/879kf95c(VS.80).aspx[^]
Hope that helps.
|
|
|
|
|
Originaly posted at channel9, but without any success so I'll try here.
I started out to create a simple (but cool) image uploader.
I created a new web project just to test and got it working.
I then copied the code over to my real web app, and guess what; it didnt work!
I upload the exact same picture from both applications, but only the one from my test project can be displayed.
If I try to display a picture uploaded from the real app in my test project I also get the "Parameter is not valid" when doing Image.FromStream().
So I guess there's something happening when it writes the data to the db, but I just cant find out what. Its the exact same code in both web apps.
Heres some code;
From my test app:
private void SaveImageToDb(Stream imgStream, string contentType, int byteLength) {
string sql = "INSERT INTO sysTmpImg_TempImage (sysTmp_recno, sysTmp_contentType, sysTmp_image) VALUES(@recno, contentType, @image)";
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myPetDb"].ConnectionString);
SqlCommand com = new SqlCommand(sql, conn);
byte[] biImage = new byte[byteLength];
imgStream.Read(biImage, 0, byteLength);
com.Parameters.Add(new SqlParameter("@recno", Session.SessionID));
com.Parameters.Add(new SqlParameter("@contentType", contentType));
com.Parameters.Add(new SqlParameter("@image", biImage));
if (conn.State != ConnectionState.Open) {
conn.Open();
}
com.ExecuteNonQuery();
conn.Close();
com.Dispose();
imgStream.Dispose();
LoadImage(Session.SessionID);
}
(load image just loads the uploaded image)
From my real app;
public void AddNewTempImage(int usRecno, string tmpRecno, Stream imageStream, string contentType, int byteLength) {
byte[] byteImage = new byte[byteLength];
imageStream.Read(byteImage, 0, byteLength);
string sql = "INSERT INTO sysTmpImg_TempImage (sysTmp_recno, sysTmp_US_recno, sysTmp_contentType, sysTmp_image) VALUES(@tmpRecno, @usRecno, @contentType, @image)";
SqlCommand com = DataHelper.GetCommand(sql);
com.Parameters.Add(new SqlParameter("@tmpRecno", tmpRecno));
com.Parameters.Add(new SqlParameter("@usRecno", usRecno));
com.Parameters.Add(new SqlParameter("@contentType", contentType));
com.Parameters.Add(new SqlParameter("@image", byteImage));
DataHelper.ExecuteNonQuery(com);
imageStream.Dispose();
}
I'll even throw in the code for the DataHelper object;
internal static class DataHelper
{
public static DataSet Execute(SqlCommand command) {
DataSet result = new DataSet();
SqlDataAdapter adap = new SqlDataAdapter(command);
adap.Fill(result);
return result;
}
public static void ExecuteNonQuery(SqlCommand command) {
CheckConnection(command.Connection);
command.ExecuteNonQuery();
command.Connection.Close();
}
public static object ExecuteScalar(SqlCommand command) {
object result = null;
CheckConnection(command.Connection);
result = command.ExecuteScalar();
command.Connection.Close();
return result;
}
public static SqlCommand GetCommand() {
return GetCommand(string.Empty);
}
public static SqlCommand GetCommand(string commandText) {
SqlCommand result = new SqlCommand(commandText, GetConnection());
return result;
}
private static void CheckConnection(SqlConnection connection) {
if (connection.State == ConnectionState.Closed) {
connection.Open();
}
}
private static SqlConnection GetConnection() {
ConnectionStringSettings connString = ConfigurationManager.ConnectionStrings["mainDb"];
return new SqlConnection(connString.ConnectionString);
}
}
Even though Im using the datahelper, the result should be the same...
I've created a generic handler to display the pictures and this is the line where it fails;
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
I could also include the code for the handlers, but since none of them can display anything I upload from my real app (but from my test app) I think the problem must be somewhere in the saving of the images.
I've checked the bytes and they match up in length from both the apps.
|
|
|
|
|
Are both databases the same ? Might the data be getting mangled as it's stored ? Have you tried storing a small image to both and then getting both byte streams and comparing them ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi and thanks for the fast reply.
Yes its the same database.
Now I tried with a smaller picture and still the same.
I've actually copied over EXACTLY the same code from my test app so the real app doesnt use the DataHelper object and I still get the same error
So yeah.. Im stuck..
|
|
|
|
|
What if you insert it with one page, and then try to retrieve it from the other ? This way you can tell if the issue is with the data going in, or coming out.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thats what I'm doing now.
I upload the picture using my real app and try to display it in the test app, ending up with "Parameter not valid".
If I use the test app to upload it works.
So its clearly the storing of the images, I just cant figure out what it is. The code in both project looks exactly the same, the same db and the same connectionstring.. Go figure
I'll probably end up with saving to disk and just storing a pointer in the db, but I don't like to change the design just because I can't figure out the issue, if you know what I mean
|
|
|
|
|
Yeah. What if you compare the bytes that are stored then, to try to work out how they differ ( are they the same size ? Are they modified in some consistent way ? )
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hey
I have a CompareValidator checking that and end date is after a start date. I enter two dates in dd/mm/yyyy format so for example:
start = 21/03/2009
end = 22/03/2009
The client side validation seems happy enough and doesn't whinge. However when I submit the form the server side sets the Page.IsValid to false and the specific validator's error message is shown. First thoughts were localisation settings so I added UICulture="en" Culture="en-GB" to the page tag. However the same response.
The client side seems happy but the server side doesnt.
Does any one have any ideas?
*Edit also tried uiCulture and culture as the msdn article had a typo.
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
modified on Thursday, March 19, 2009 6:41 PM
|
|
|
|
|
Hey
Half solved this, it seemed to be a "quirk" with a devx DateEdit control, I just replaced it with a text box with appropriate validation for now.
At university studying Software Engineering - if i say this line to girls i find they won't talk to me
Dan
|
|
|
|
|
So I've searched for hours for a good fix or a workaround on this problem.
What is needed : Draw a background canvas(white), and on top of it I have to draw - Grid(with transparent background), Graph1(with transparent background), Graph2(with transparent background) and whatever else.
What is done : I have all the functions which all work, but only when they aren't ontop of each other.
Problem : Everything I draw with a seperate function has a white background (NOTE: Something.Clear(Color.Transparent); doesn't work, makes the background black.. which really won't help)
So I've found some workarounds how to do completely transparent pictures and I even found some .dll that would suit me BUT it has some nice licence things that won't work for me unfortunately, so I'm back to square one.
[PS. I hope people won't start to flame to look harder on Google or whatever, so all I can say is.. I have and I was unsuccsessful]
|
|
|
|
|
Your browser will display pngs with transparency, I thought. This all sounds a little too difficult to me tho, have you considered using silverlight instead ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
No I haven't.. Guess I'll take a look into it right away
(about the Png, for some reason it didn't even let me save to png.. but I had no problem saving to Gif.. so I'll take a look into that aswell)
|
|
|
|
|
Hello,
I'm not sure if this is the right forum to ask my question, but it involves Flash and .net.
I need to drag small images and place them over a larger image such that they blend well and look like one image. This image then needs to be saved in the database (SQL Server). Later this image needs to be fetched from the db and displayed in the format it was saved earlier. I am new to flash and have no clues how to go about this.
The site is developed in .net and the database used is SQL Server and the above described functionality needs to be developed using Flash/Ajax/Javascript.
Any help would be appreciated.
Thanks.
|
|
|
|
|
So, this is essentially a flash question ? I'd suggest trying the web dev forum, but I'm not sure if this is the right place for Flash questions overall.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I'm trying to build a sitemap so users can follow the path.
My issue is that I can have multiple same landing pages of categories under different industries or products.
Here is a sample of my sitemap:
<siteMapNode url="~/home.aspx" title="Home" description="Home Page">
<siteMapNode url="~/industry.aspx?ztid=0" title="Automotive" description="">
<siteMapNode url="~/productDetails.aspx?catID=16" title="Wire Marker Booklets" />
<siteMapNode url="~/productDetails.aspx?catID=28" title="Cable Marker Dispenser" />
</siteMapNode>
<siteMapNode url="~/industry.aspx?ztid=1" title="Aviation/Aerospace" description="" />
<siteMapNode url="~/productDetails.aspx?catID=1" title="Self-Laminating Labels" />
</siteMapNode>
<siteMapNode url="~/productList.aspx?ztid=0" title="Pre-printed Wire Markers" >
<siteMapNode url="~/productDetails.aspx?catID=16" title="Wire Marker Booklets" />
<siteMapNode url="~/productDetails.aspx?catID=28" title="Cable Marker Dispenser" />
</siteMapNode>
<siteMapNode url="~/productList.aspx?ztid=1" title="Self Laminated Labels" />
<siteMapNode url="~/productDetails.aspx?catID=1" title="Self-Laminating Labels" />
<siteMapNode url="~/productDetails.aspx?catID=16" title="Wire Marker Booklets" />
</siteMapNode>
<siteMapNode url="~/productList.aspx?ztid=2" title="Blank Printable" description="" />
<siteMapNode url="~/productDetails.aspx?catID=1" title="Self-Laminating Labels" />
<siteMapNode url="~/productDetails.aspx?catID=16" title="Wire Marker Booklets" />
<siteMapNode url="~/productDetails.aspx?catID=28" title="Cable Marker Dispenser" />
</siteMapNode>
</siteMapNode>
How could I create this without having to create like
<siteMapNode url="~/productDetails.aspx?catID=28a" title="Cable Marker Dispenser" />
<siteMapNode url="~/productDetails.aspx?catID=28b" title="Cable Marker Dispenser" />
<siteMapNode url="~/productDetails.aspx?catID=28c" title="Cable Marker Dispenser" />
So it won't create an error? Would also not be efficient for programming.
Please advise, I'm also open to other solutions.
Thanks
Thomas
|
|
|
|
|
We have a webservice that seemed to be doing fine until it wasn't - and we are having a @@#$!! of a time figuring out what happened.
We added "better" caching in and were fairly confident it was caching when it was supposed to and expiring when it was supposed to.
The question is: how to do better upfront testing? How do you best go about stress testing your app before it embarasses you?
Thanks.
|
|
|
|
|
There are many tools out there. I have used WebLoad[^] and it worked well for me.
|
|
|
|
|
|
dd314159 wrote: We have a webservice that seemed to be doing fine until it wasn't
Isn't that the case all the time?
dd314159 wrote: How do you best go about stress testing your app before it embarasses you?
embarrass who? I always put 3 piece suite and look good in front of my customers.
Seriously, Have you tried Web Application Stress Tool?[^]
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
|
|
I am just planning to go to Minnesota for a food festival so I can see Judas Priest play all of British Steel for $10. So, when you said 'grinder'... ( grinder is a song on that album )
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Can Any one done this before, i am struck here.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
I don't think a listbox can show images.
|
|
|
|