|
Good Morning All
I have a WebSetup Project and a Installer Class. I want to accept User
Database Server
Username
Password
E-mail
This is what i did so far. I have created a Websetup Class installer that looks like this
namespace ClassLib
{
[RunInstaller(true)]
public class ClassLib : Installer
{
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
string targetSite = Context.Parameters["TargetSite"];
string targetVDir = Context.Parameters["TargetVdir"];
string targetDir = Context.Parameters["TargetDir"];
if (targetSite.StartsWith("/LM/"))
targetSite = targetSite.Substring(4);
writeEventLogs();
createConnectionString(targetSite, targetVDir, targetDir);
RegisterScriptMaps(targetSite, targetVDir);
}
void RegisterScriptMaps(string targetSite, string targetVDir)
{
string sysRoot = System.Environment.GetEnvironmentVariable("SystemRoot");
DirectoryInfo di = new DirectoryInfo(sysRoot + "/Microsoft.NET/Framework");
DirectoryInfo[] frameworkDir = di.GetDirectories("v2.0.*", SearchOption.TopDirectoryOnly);
int big = 0;
for (int i = 0; i < frameworkDir.Length; i++)
{
int current = Convert.ToInt32(frameworkDir[i].Name.Substring(5));
if (current > big)
{
big = current;
}
}
string latestFramework = di.FullName + "\\v2.0." + big.ToString();
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = latestFramework + "\\aspnet_regiis.exe";
info.Arguments = string.Format("-s {0}/ROOT/{1}", targetSite, targetVDir);
info.CreateNoWindow = true;
info.UseShellExecute = false;
Process.Start(info);
}
void writeEventLogs()
{
}
void createConnectionString(string targetSite, string targetVDir, string targetDir)
{
DirectoryEntry entry = new DirectoryEntry("IIS://LocalHost/" + targetSite);
string friendlySiteName = entry.Properties["ServerComment"].Value.ToString();
entry.Properties["ConnectionTimeout"][0] = 1800;
entry.CommitChanges();
entry = new DirectoryEntry("IIS://LocalHost/" + targetSite + "/ROOT/" + targetVDir);
entry.Properties["AspScriptTimeout"][0] = 1800;
entry.Properties["AspSessionTimeout"][0] = 60;
entry.CommitChanges();
FileSecurity fSecurity = File.GetAccessControl(targetDir + "App_Data");
string LocalUserName = Environment.MachineName + "\\IUSR_" + Environment.MachineName;
string LocalGroupName = Environment.MachineName + "\\IIS_WPG";
try
{
fSecurity.AddAccessRule(new FileSystemAccessRule(LocalGroupName, FileSystemRights.FullControl, AccessControlType.Allow));
fSecurity.AddAccessRule(new FileSystemAccessRule(LocalUserName, FileSystemRights.FullControl, AccessControlType.Allow));
File.SetAccessControl(targetDir + "App_Data", fSecurity);
}
catch
{
}
Configuration config = WebConfigurationManager.OpenWebConfiguration("/" + targetVDir, friendlySiteName);
config.AppSettings.Settings["installpath"].Value = targetDir.Substring(0, targetDir.Length - 1);
config.AppSettings.Settings["DBuser"].Value = login();
config.AppSettings.Settings["adminEmail"].Value = Context.Parameters["adminEmail"];
config.ConnectionStrings.ConnectionStrings["DBConnectionString"].ConnectionString = connectionString("oDirectv3");
config.ConnectionStrings.ConnectionStrings["oDirectConnectionString"].ConnectionString = connectionString("oDirectv3");
((CompilationSection)config.GetSection("system.web/compilation")).Debug = false;
config.Save();
}
string connectionString(string db)
{
string server = string.Empty;
if (Context.Parameters["Server"] != string.Empty)
{
server += "Data Source=" + Context.Parameters["Server"] + ";Initial Catalog=" + db + ";Persist Security Info=True;" + login();
}
return server;
}
string login()
{
string login = string.Empty;
if ((Context.Parameters["Username"] != string.Empty) && (Context.Parameters["Password"] != string.Empty))
{
login += "User ID=" + Context.Parameters["Username"] + ";Password=" + Context.Parameters["Password"];
}
return login;
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
}
}
After that i went to the user interface and added a "Textboxes(A)" and the Properties are like this
EDITA1 = Database Server:
EDITA2 = Username:
EDITA3 = Password:
EDITA4 = System Administrator Email Address:
After here i have created the output(Primary) for the Class Project and for my Website its contents and moved them to the bin Directory.
After that i have created a Cumstom action and i went to the install and Add the Project that is in the bin Derectory and went to the Properties of the Custom Action for install and Added the Following in the "Custom Action Data" Property.
/installpath ="[ EDITA1]\" / DBuser ="[ EDITA2]" /password="[ EDITA3]" / adminEmail ="[ EDITA4]"
Well am not sure about what i have wrote here , your help will be apreciated. After i have done that i have build my setup Project and it came back with no Errors or warning and i tried to install the setup and i filled in the server,username,password and e-mail and after that it continues to install and at the end it gives an Error
"Object reference not set to an instance of an object"
What is it that am Doing wrong ?
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
Hi friends,
I am using Asp.net application and sql server 2005. I assigned job for users using job scheduling. ie activate and deactivate while we assign the job at particular time it change at that time(activate/deactivate). While the changes will come at that time i need to send mail for that particular user.
Normally we can send mail using asp.net i know.But in this scenario how can we send mail automatically in db.
IF you have any idea, reply me.
Hope yours reply.
Every Successful Person Have A Painful Story
|
|
|
|
|
hello
i want connectivity in javascript
use asp.net forms
and with use timercontrol at featch record nevigatio from database
|
|
|
|
|
Could be complicate since javascript is client-side and (I assume) the database is at the server.
And why do you want to use a timercontrol for fetching records?
|
|
|
|
|
sounds like you want to make AJAX calls to get data from your database.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi
I have a senario like this i am getting a login page on webbrowser control.
i type user-id and password.on sucessfull login server sends the response which has the cookie Id and Cookie value.How can i get those information.
And on which event i will get those details, Because the submit button is a part of the html content that has loaded to webbroswer control.
(Like i pass a url webbrowser1.url(http://mail.yahoo.com);
i got yahoo mail page in webbrowser control. i typed my userid and password and click submit.In the response i should get the cookie value send by yahoo on a message box.
Please Reply
|
|
|
|
|
|
Hi,
well you have to create a table (whether with 60 columns for each checkbox or a single column where you encrypt the values as a 60-bit long value) and then you have to write a method to store (and another to read) them in the database.
So where is your exact problem? (connection string not working etc.?)
And what do you mean with "pair in 3 at..."?
Regards
Sebastian
|
|
|
|
|
You probably want to lay them out with a repeater so you can make three columns.
Also sounds like you could use a book on ASP.NET.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I admire your ability to comprehend what they want by reading their posts...
|
|
|
|
|
Years of practice....
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I am new to SQL data source. I got this coding from net.
<asp:sqldatasource id="Sqlds1" runat="server" datasourcemode="DataReader" connectionstring="<%$ ConnectionStrings:Project%>" xmlns:asp="#unknown">
SelectCommand="SELECT image_path,comments FROM photos where user_id=? and image_id=? and heading=?">
<selectparameters>
<asp:querystringparameter name="path" querystringfield="Label1">
<asp:querystringparameter name="imgid" querystringfield="Label2">
<asp:querystringparameter name="heading" querystringfield="Label3">
<asp:gridview xmlns:asp="#unknown">
id="GridView2"
runat="server"
DataSourceID="Sqlds1">
While executing this coding i got a error in this line of code.
asp:SqlDataSource id="Sqlds1" runat="server" DataSourceMode="DataReader
as InvalidOperationException was unhandled by usercode. Can anyone correct it>
|
|
|
|
|
Did you make sure you had a connection string, and so on ? Either way, SqlDataSources suck, you are better of writing a proper data layer.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
How to add DateTimePicker ColumnStyle in GridView used to select date and time, and to display that date/time in DataGridView in windows application
|
|
|
|
|
you can use a java script calander function and call it in the "onfocus" event of the textbox while you are in edit mode of the gridview..
For java script calender function you can look at
This[^]">
Pradip Kishore
modified on Friday, February 6, 2009 6:13 AM
|
|
|
|
|
Hi ,thanx for the answer but i am using desktop application so cannot use javascript and all..
|
|
|
|
|
dude..then its the wrong forum for you...choose the right forum to post your query so that you will get an answer to it
Pradip Kishore
|
|
|
|
|
I need a ERP project using ASP.net with source code. I want to see the modules and coding. If anybody wil knows about that send to my mail,I will be Thankful for you.Thank You
|
|
|
|
|
You see here we dont Sell or Give people Projects. What we do here we help people who started something and got stucked. i dont know mybe someone lied to you and tell you that you can get anything you want in Forums, but here you must have manners when you ask and we dont do work for other people
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
|
Either
1 - tell your client you are a thief or
2 - tell your teacher you need help or
3 - start more slowly, and buy a book and work through it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
i am going to develope a site, and i want to use Vista look Like menu in javascript or in .NET,
from where i can get it ???
any site ???
any hint ???
thankx in advance
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
You can create bitmaps and skin your site any way you like, if you don't mind the extra bandwidth and lack of flexibility. Otherwise, stick to what css will do for you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
hi,
how to update gridview using button field?I have added the button by adding new column.
regards,
Bill
|
|
|
|