|
Hi Everyone,
I have two web applications, hosted in ISS with different virtual names.
Both applications are having their own databases but users for both applications are same, and both are SqlServer Session mode (session db is same for both).
If user logs into the first application, in the landing page we are giving link to second application along with all other links.
Here I want to use same sessions of first application and need to validate the user in second application and navigate him to his home page of second application, insted of again displaying login screen to the user.
Note: Both are different application hosted with different virtual names.
Hope my question is clear, how can I achieve this concept using SqlServer Session Mode.
Thanks
Hari
|
|
|
|
|
|
Good Day all
In my Application there some error that i dont want my users to see, what i do i send them to myself as an e-mail. that is working. now i want to send the description of the Error to myself. The First thing i do when there is an unhandled exception, i send a user to another page and send an e-mail to myself. i was able to compile a subject and the i want to get the Exception in the Body of my e-mail. How can i get the Error Description of the Page.
First i Made sure the when there is an Error i will redirect the users to a certain page like this
<customErrors mode="On" defaultRedirect="Error.aspx">
<error statusCode="403" redirect="Error.aspx"/>
<error statusCode="404" redirect="Error.aspx"/>
</customErrors>
now in the page load if the page i have this
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Send_log();
}
}
and my method is defined as
private void Send_log()
{
String Client_URL = GetCurrentPageName();
Exception objErr = Server.GetLastError();
MailMessage mm = new MailMessage();
SmtpClient smtp = new SmtpClient();
mm.From = new MailAddress("vuyiswamb@gmail.com");
mm.To.Add(new MailAddress("Vuyiswa@its.co.za"));
mm.Subject = "Exception Report from " + Client_URL + "In EXAM/CLASS";
mm.Body = objErr.ToString();
mm.IsBodyHtml = true;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = "vuyiswamb@gmail.com";
NetworkCred.Password = "wow";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
Now the Problem is in this object
Exception objErr = Server.GetLastError();
it always brings back nulls. now.Now am testing this Methiod with a page not Found Error , something like this
Response.Redirect("MissingPage.aspx");
Thanks
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.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Add Global.asax to you project and add "sending of the mail" code inside Application_Error method and use Server.GetLastError().GetBaseException() to catch the exception.
|
|
|
|
|
Respected Sir
I am using visualstudio2008 i want to allows the textbox with leeters and charecters but not special charecters i want to restrict the textbox not allowing special charecters i am using 4 validations controls By Using Validation controls how i can achive
Laxman
|
|
|
|
|
Do it yourself like this
void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsLetterOrDigit((e.KeyChar)))
{
e.Handled = true;
}
hope it helps
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.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
This would only work on Windows Forms textboxes. This is an ASP.NET question.
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Use Regular expression validator and provide the validation expression something like:
[a-zA-Z0-9]+
Hope this will help.
|
|
|
|
|
I created a masterpage.But i am not able to drag or change the size of a contentplace holder.I checked the positioning options and set it as absolute.But still it is not working
|
|
|
|
|
How to lock code execution without specifying lock() on particular variable?
I neet to lock the function call.
...
SomeFunction();
...
Чесноков
|
|
|
|
|
Why, are you multi-threading? If so then lock is the correct way to go, otherwise your question makes no sense.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Well, I call unmanaged function from dll, and its declaration is static using PInvoke.
If several clients connect to the site and call it all at once, will it crash?
Чесноков
|
|
|
|
|
I think Lock Statement is essential when you are calling the same function from different threads. ASP.NET is multi threaded environment and IIS runs each thread in each Session it creates.
I believe lock construct is same as
try
{
Monitor.Enter(
}
finally
Monitor.Exit();
You can use Monitor.TryEnter rather than Monitor.Enter as you can give the extra parameter which indicates how much to wait, which results better performance to your website, and also the website wil not crash even if you are accessing a shared variable.[At least you can overcome the deadlock situation]
|
|
|
|
|
I've got the folder in the project, and the files are not added to the project, since during debugging its contents vary, the site creates or removes some of them during execution.
But how in the same mode as \bin folder contents are all copied during publish operation to the target dir, enable the same coping of all that folder contents during publish operation?
Чесноков
|
|
|
|
|
Dear all,
Can any one tell me how to open OUTLOOK MAIL Window
When i click EmailID in my aspx page,
Iam using the folling code
<asp:hyperlink id="hyp" runat="server" navigateurl="mail:sgsdg@gmail.com"/>
Above code is working when i have outlook in my local machine,
If i don't have OUTLOOK in my machine it is showing pop message(error),
If we Install MS OUTLOOK in My LIVE SERVER whether that will work?
Is there any other solution for this?
regards
kish!!!!
|
|
|
|
|
It will open the default mail client of the client machine.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
It has nothing to do with Server.
I will open default mailclient on client machine.
|
|
|
|
|
Image1.ImageUrl = TextBox1.Text;
//textbox receive path of the image for example textbox=c:\Blue hills.jpg;
//but image is not show in the image control
|
|
|
|
|
At this point, is the image on the server or the client's machine? i.e. has the image been uploaded yet?
Also, you shouldn't double post, sometimes causes friction around here!
|
|
|
|
|
the image must be inside your project... outside images that is c:\Blue hills.jpg will never been considered....
|
|
|
|
|
how to make database connectivity globally?
behind asp.net form i will write only insert query .
the code for insert query should be global?
|
|
|
|
|
in one of my application, a user connect to deterrent databases that gets chosen on the login Screen. Now i change the Connection string Dynamically. In my Data layer i will have something like this
private string GetConnectionString(string DB)
{
string connString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;
if (DB != null)
{
return connString.Replace("oDirectv3", DB);
}
else
{
return connString.Replace("oDirectv3", "oDirectv3");
}
}
and my Connection String will look like this
<add name="DBConnectionString" connectionString="Data Source=VUYISWA\SQLEXPRESS;Initial Catalog=oDirectv3;Persist Security Info=True;User ID=V;Password=wow" providerName="System.Data.SqlClient"/>
So what ever sql statement you run to the database will Correspond
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.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
i am using controls
1- image control
2- file upload
i try to upload a file in image control that display in image control as the file uploaded. and save it in database on submit button event
|
|
|
|
|
and what happens when you try?
|
|
|
|
|
your question is
1) you will upload a image file in fileupload.
2) when you press save button it should save in database as well as that image must be shown in the image control.
is that correct...
|
|
|
|